repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Organizations/Teams.php
Teams.addTeamRepository
public function addTeamRepository(int $id) { $return = $this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos/:org/:repo', (string)$id, $this->getOrganizations()->getOwner(), $this->getOrganizations()->getRepo()), Request::METHOD_PUT); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return $return; }
php
public function addTeamRepository(int $id) { $return = $this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos/:org/:repo', (string)$id, $this->getOrganizations()->getOwner(), $this->getOrganizations()->getRepo()), Request::METHOD_PUT); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return $return; }
[ "public", "function", "addTeamRepository", "(", "int", "$", "id", ")", "{", "$", "return", "=", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/teams/:id/repos/:org/:repo'", ","...
Add team repository @link https://developer.github.com/v3/orgs/teams/#add-team-repo @param int $id @return bool|array @throws \Exception
[ "Add", "team", "repository" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Organizations/Teams.php#L234-L244
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Organizations/Teams.php
Teams.removeTeamRepository
public function removeTeamRepository(int $id): bool { $this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos/:owner/:repo', (string)$id, $this->getOrganizations()->getOwner(), $this->getOrganizations()->getRepo()), Request::METHOD_DELETE); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
php
public function removeTeamRepository(int $id): bool { $this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos/:owner/:repo', (string)$id, $this->getOrganizations()->getOwner(), $this->getOrganizations()->getRepo()), Request::METHOD_DELETE); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
[ "public", "function", "removeTeamRepository", "(", "int", "$", "id", ")", ":", "bool", "{", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/teams/:id/repos/:owner/:repo'", ",", ...
Remove team repository @link https://developer.github.com/v3/orgs/teams/#remove-team-repo @param int $id @return bool @throws \Exception
[ "Remove", "team", "repository" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Organizations/Teams.php#L256-L266
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/Pages.php
Pages.getInformation
public function getInformation(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pages', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); }
php
public function getInformation(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pages', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); }
[ "public", "function", "getInformation", "(", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/pages'", ",", "$", "this", "->"...
Get information about a Pages site @link https://developer.github.com/v3/repos/pages/#get-information-about-a-pages-site @return array
[ "Get", "information", "about", "a", "Pages", "site" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Pages.php#L19-L23
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/Pages.php
Pages.listPagesBuilds
public function listPagesBuilds(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pages/builds', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); }
php
public function listPagesBuilds(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pages/builds', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); }
[ "public", "function", "listPagesBuilds", "(", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/pages/builds'", ",", "$", "this"...
List Pages builds @link https://developer.github.com/v3/repos/pages/#list-pages-builds @return array
[ "List", "Pages", "builds" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Pages.php#L31-L35
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Organizations/Members.php
Members.listPublicMembers
public function listPublicMembers(string $org): array { return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/public_members', $org)); }
php
public function listPublicMembers(string $org): array { return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/public_members', $org)); }
[ "public", "function", "listPublicMembers", "(", "string", "$", "org", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/orgs/:org/public_members'",...
Public members list @link https://developer.github.com/v3/orgs/members/#public-members-list @param string $org @return array @throws \Exception
[ "Public", "members", "list" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Organizations/Members.php#L89-L92
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Organizations/Members.php
Members.getOrganizationMembership
public function getOrganizationMembership(string $org, string $username): array { $this->getApi()->setAccept('application/vnd.github.moondragon+json'); return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/memberships/:username', $org, $username)); }
php
public function getOrganizationMembership(string $org, string $username): array { $this->getApi()->setAccept('application/vnd.github.moondragon+json'); return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/memberships/:username', $org, $username)); }
[ "public", "function", "getOrganizationMembership", "(", "string", "$", "org", ",", "string", "$", "username", ")", ":", "array", "{", "$", "this", "->", "getApi", "(", ")", "->", "setAccept", "(", "'application/vnd.github.moondragon+json'", ")", ";", "return", ...
Get organization membership @link https://developer.github.com/v3/orgs/members/#get-organization-membership @param string $org @param string $username @return array @throws \Exception
[ "Get", "organization", "membership" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Organizations/Members.php#L173-L178
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Organizations/Members.php
Members.removeOrganizationMembership
public function removeOrganizationMembership(string $org, string $username): bool { $this->getApi()->setAccept('application/vnd.github.moondragon+json'); $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/memberships/:username', $org, $username), Request::METHOD_DELETE); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
php
public function removeOrganizationMembership(string $org, string $username): bool { $this->getApi()->setAccept('application/vnd.github.moondragon+json'); $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/memberships/:username', $org, $username), Request::METHOD_DELETE); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
[ "public", "function", "removeOrganizationMembership", "(", "string", "$", "org", ",", "string", "$", "username", ")", ":", "bool", "{", "$", "this", "->", "getApi", "(", ")", "->", "setAccept", "(", "'application/vnd.github.moondragon+json'", ")", ";", "$", "t...
Remove organization membership @link https://developer.github.com/v3/orgs/members/#remove-organization-membership @param string $org @param string $username @return bool @throws \Exception
[ "Remove", "organization", "membership" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Organizations/Members.php#L212-L224
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Organizations/Members.php
Members.getYourOrganizationMembership
public function getYourOrganizationMembership(string $org): array { return $this->getApi()->request($this->getApi()->sprintf('/user/memberships/orgs/:org', $org)); }
php
public function getYourOrganizationMembership(string $org): array { return $this->getApi()->request($this->getApi()->sprintf('/user/memberships/orgs/:org', $org)); }
[ "public", "function", "getYourOrganizationMembership", "(", "string", "$", "org", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/user/membership...
Get your organization membership @link https://developer.github.com/v3/orgs/members/#get-your-organization-membership @param string $org @return array @throws \Exception
[ "Get", "your", "organization", "membership" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Organizations/Members.php#L252-L255
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Issues/Events.php
Events.listIssueEvents
public function listIssueEvents(int $issueNumber): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:issue_number/events', $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $issueNumber)); }
php
public function listIssueEvents(int $issueNumber): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:issue_number/events', $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $issueNumber)); }
[ "public", "function", "listIssueEvents", "(", "int", "$", "issueNumber", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/issue...
List events for an issue @link https://developer.github.com/v3/issues/events/#list-events-for-an-issue @param int $issueNumber @return array
[ "List", "events", "for", "an", "issue" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Issues/Events.php#L22-L26
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Issues/Events.php
Events.listRepositoryEvents
public function listRepositoryEvents(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events', $this->getIssues()->getOwner(), $this->getIssues()->getRepo())); }
php
public function listRepositoryEvents(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events', $this->getIssues()->getOwner(), $this->getIssues()->getRepo())); }
[ "public", "function", "listRepositoryEvents", "(", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/issues/events'", ",", "$", ...
List events for a repository @link https://developer.github.com/v3/issues/events/#list-events-for-a-repository @return array
[ "List", "events", "for", "a", "repository" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Issues/Events.php#L34-L38
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Issues/Labels.php
Labels.listRepositoryLabels
public function listRepositoryLabels(): array { return $this->getApi()->request($this->getApi() ->sprintf('/repos/:owner/:repo/labels', $this->getIssues()->getOwner(), $this->getIssues()->getRepo())); }
php
public function listRepositoryLabels(): array { return $this->getApi()->request($this->getApi() ->sprintf('/repos/:owner/:repo/labels', $this->getIssues()->getOwner(), $this->getIssues()->getRepo())); }
[ "public", "function", "listRepositoryLabels", "(", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/labels'", ",", "$", "this",...
List all labels for this repository @link https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository @return array
[ "List", "all", "labels", "for", "this", "repository" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Issues/Labels.php#L21-L26
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Issues/Labels.php
Labels.getLabel
public function getLabel(string $name): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/labels/:name', $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $name)); }
php
public function getLabel(string $name): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/labels/:name', $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $name)); }
[ "public", "function", "getLabel", "(", "string", "$", "name", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/labels/:name'", ...
Get a single label @link https://developer.github.com/v3/issues/labels/#get-a-single-label @param string $name @return array
[ "Get", "a", "single", "label" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Issues/Labels.php#L37-L41
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Issues/Labels.php
Labels.updateLabel
public function updateLabel(string $name, string $color): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/labels/:name', $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $name), Request::METHOD_PATCH, [ 'color' => $color ]); }
php
public function updateLabel(string $name, string $color): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/labels/:name', $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $name), Request::METHOD_PATCH, [ 'color' => $color ]); }
[ "public", "function", "updateLabel", "(", "string", "$", "name", ",", "string", "$", "color", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", ...
Update a label @link https://developer.github.com/v3/issues/labels/#update-a-label @param string $name @param string $color @return array
[ "Update", "a", "label" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Issues/Labels.php#L73-L79
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Issues/Labels.php
Labels.deleteLabel
public function deleteLabel(string $name): bool { $this->getApi()->request($this->getApi() ->sprintf('/repos/:owner/:repo/labels/:name', $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $name)); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
php
public function deleteLabel(string $name): bool { $this->getApi()->request($this->getApi() ->sprintf('/repos/:owner/:repo/labels/:name', $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $name)); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
[ "public", "function", "deleteLabel", "(", "string", "$", "name", ")", ":", "bool", "{", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/labels/:name'", ",", "...
Delete a label @link https://developer.github.com/v3/issues/labels/#delete-a-label @param string $name @return bool
[ "Delete", "a", "label" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Issues/Labels.php#L90-L101
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Issues/Labels.php
Labels.removeIssueLabel
public function removeIssueLabel(int $number, string $name): bool { $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/labels/:name', $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number, $name), Request::METHOD_DELETE); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
php
public function removeIssueLabel(int $number, string $name): bool { $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/labels/:name', $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number, $name), Request::METHOD_DELETE); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
[ "public", "function", "removeIssueLabel", "(", "int", "$", "number", ",", "string", "$", "name", ")", ":", "bool", "{", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos...
Remove a label from an issue @link https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue @param int $number @param string $name @return bool
[ "Remove", "a", "label", "from", "an", "issue" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Issues/Labels.php#L143-L153
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Issues/Labels.php
Labels.replaceIssuesLabels
public function replaceIssuesLabels(int $number): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/labels', $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_PUT); }
php
public function replaceIssuesLabels(int $number): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/labels', $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_PUT); }
[ "public", "function", "replaceIssuesLabels", "(", "int", "$", "number", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/issues...
Replace all labels for an issue @link https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue @param int $number @return array
[ "Replace", "all", "labels", "for", "an", "issue" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Issues/Labels.php#L164-L168
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Issues/Labels.php
Labels.removeIssueLabels
public function removeIssueLabels(int $number): bool { $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/labels', $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_DELETE); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
php
public function removeIssueLabels(int $number): bool { $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/labels', $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_DELETE); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
[ "public", "function", "removeIssueLabels", "(", "int", "$", "number", ")", ":", "bool", "{", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/issues/:number/labels...
Remove all labels from an issue @link https://developer.github.com/v3/issues/labels/#remove-all-labels-from-an-issue @param int $number @return bool
[ "Remove", "all", "labels", "from", "an", "issue" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Issues/Labels.php#L179-L189
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/Deployments.php
Deployments.createDeployement
public function createDeployement(string $ref, string $task = AbstractApi::TASK_DEPLOY, bool $autoMerge = true, array $requiredContexts = [], string $payload = '', string $environment = AbstractApi::ENVIRONMENT_PRODUCTION, string $description = ''): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/deployments', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, [ 'ref' => $ref, 'task' => $task, 'auto_merge' => $autoMerge, 'required_contexts' => $requiredContexts, 'payload' => $payload, 'environment' => $environment, 'description' => $description ]); }
php
public function createDeployement(string $ref, string $task = AbstractApi::TASK_DEPLOY, bool $autoMerge = true, array $requiredContexts = [], string $payload = '', string $environment = AbstractApi::ENVIRONMENT_PRODUCTION, string $description = ''): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/deployments', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, [ 'ref' => $ref, 'task' => $task, 'auto_merge' => $autoMerge, 'required_contexts' => $requiredContexts, 'payload' => $payload, 'environment' => $environment, 'description' => $description ]); }
[ "public", "function", "createDeployement", "(", "string", "$", "ref", ",", "string", "$", "task", "=", "AbstractApi", "::", "TASK_DEPLOY", ",", "bool", "$", "autoMerge", "=", "true", ",", "array", "$", "requiredContexts", "=", "[", "]", ",", "string", "$",...
Create a Deployment @link https://developer.github.com/v3/repos/deployments/#create-a-deployment @param string $ref @param string $task @param bool $autoMerge @param array $requiredContexts @param string $payload @param string $environment @param string $description @return array
[ "Create", "a", "Deployment" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Deployments.php#L51-L66
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/Deployments.php
Deployments.createDeploymentStatus
public function createDeploymentStatus(int $id, string $state, string $targetUrl = '', string $description = ''): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/deployments/:id/statuses', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_POST, [ 'state' => $state, 'target_url' => $targetUrl, 'description' => $description ]); }
php
public function createDeploymentStatus(int $id, string $state, string $targetUrl = '', string $description = ''): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/deployments/:id/statuses', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_POST, [ 'state' => $state, 'target_url' => $targetUrl, 'description' => $description ]); }
[ "public", "function", "createDeploymentStatus", "(", "int", "$", "id", ",", "string", "$", "state", ",", "string", "$", "targetUrl", "=", "''", ",", "string", "$", "description", "=", "''", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", ...
Create a Deployment Status @link https://developer.github.com/v3/repos/deployments/#create-a-deployment-status @param int $id @param string $state @param string $targetUrl @param string $description @return array
[ "Create", "a", "Deployment", "Status" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Deployments.php#L95-L104
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Enterprise/SearchIndexing.php
SearchIndexing.queueIndexingJob
public function queueIndexingJob(string $target): array { return $this->getApi()->request(sprintf('/staff/indexing_jobs'), Request::METHOD_POST, [ 'target' => $target ]); }
php
public function queueIndexingJob(string $target): array { return $this->getApi()->request(sprintf('/staff/indexing_jobs'), Request::METHOD_POST, [ 'target' => $target ]); }
[ "public", "function", "queueIndexingJob", "(", "string", "$", "target", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "sprintf", "(", "'/staff/indexing_jobs'", ")", ",", "Request", "::", "METHOD_POST", ",", ...
Queue an indexing job @link https://developer.github.com/v3/enterprise/search_indexing/#queue-an-indexing-job @param string $target @return array
[ "Queue", "an", "indexing", "job" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Enterprise/SearchIndexing.php#L24-L29
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Activity/Watching.php
Watching.listSubscriptions
public function listSubscriptions(string $username = null): array { if (null !== $username) { return $this->getApi()->request($this->getApi()->sprintf('/users/:username/subscriptions', $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), $username)); } return $this->getApi()->request($this->getApi() ->sprintf('/user/subscriptions', $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); }
php
public function listSubscriptions(string $username = null): array { if (null !== $username) { return $this->getApi()->request($this->getApi()->sprintf('/users/:username/subscriptions', $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), $username)); } return $this->getApi()->request($this->getApi() ->sprintf('/user/subscriptions', $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); }
[ "public", "function", "listSubscriptions", "(", "string", "$", "username", "=", "null", ")", ":", "array", "{", "if", "(", "null", "!==", "$", "username", ")", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "...
List repositories being watched @link https://developer.github.com/v3/activity/watching/#list-repositories-being-watched @param string $username @return array
[ "List", "repositories", "being", "watched" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Activity/Watching.php#L37-L47
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Activity/Watching.php
Watching.getRepositorySubscription
public function getRepositorySubscription(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/subscription', $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); }
php
public function getRepositorySubscription(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/subscription', $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); }
[ "public", "function", "getRepositorySubscription", "(", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/subscription'", ",", "$"...
Get a Repository Subscription @link https://developer.github.com/v3/activity/watching/#get-a-repository-subscription @return array
[ "Get", "a", "Repository", "Subscription" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Activity/Watching.php#L55-L59
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Activity/Watching.php
Watching.setRepositorySubscription
public function setRepositorySubscription(bool $subscribed = false, bool $ignored = false): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/subscription?:args', $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), http_build_query([ 'subscribed' => $subscribed, 'ignored' => $ignored ])), Request::METHOD_PUT); }
php
public function setRepositorySubscription(bool $subscribed = false, bool $ignored = false): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/subscription?:args', $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), http_build_query([ 'subscribed' => $subscribed, 'ignored' => $ignored ])), Request::METHOD_PUT); }
[ "public", "function", "setRepositorySubscription", "(", "bool", "$", "subscribed", "=", "false", ",", "bool", "$", "ignored", "=", "false", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", ...
Set a Repository Subscription @link https://developer.github.com/v3/activity/watching/#set-a-repository-subscription @param bool $subscribed @param bool $ignored @return array
[ "Set", "a", "Repository", "Subscription" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Activity/Watching.php#L71-L78
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Issues.php
Issues.listRepositoryIssues
public function listRepositoryIssues(string $milestone = '*', string $state = AbstractApi::STATE_OPEN, string $assignee = '*', string $creator = '', string $mentioned = '', string $labels = '', string $sort = AbstractApi::SORT_CREATED, string $direction = AbstractApi::DIRECTION_DESC, string $since = '1970-01-01'): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues?:args', $this->getOwner(), $this->getRepo(), http_build_query([ 'milestone' => $milestone, 'state' => $state, 'assignee' => $assignee, 'creator' => $creator, 'mentioned' => $mentioned, 'labels' => $labels, 'sort' => $sort, 'direction' => $direction, 'since' => (new DateTime($since))->format(DateTime::ATOM) ]))); }
php
public function listRepositoryIssues(string $milestone = '*', string $state = AbstractApi::STATE_OPEN, string $assignee = '*', string $creator = '', string $mentioned = '', string $labels = '', string $sort = AbstractApi::SORT_CREATED, string $direction = AbstractApi::DIRECTION_DESC, string $since = '1970-01-01'): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues?:args', $this->getOwner(), $this->getRepo(), http_build_query([ 'milestone' => $milestone, 'state' => $state, 'assignee' => $assignee, 'creator' => $creator, 'mentioned' => $mentioned, 'labels' => $labels, 'sort' => $sort, 'direction' => $direction, 'since' => (new DateTime($since))->format(DateTime::ATOM) ]))); }
[ "public", "function", "listRepositoryIssues", "(", "string", "$", "milestone", "=", "'*'", ",", "string", "$", "state", "=", "AbstractApi", "::", "STATE_OPEN", ",", "string", "$", "assignee", "=", "'*'", ",", "string", "$", "creator", "=", "''", ",", "stri...
List issues for a repository @link https://developer.github.com/v3/issues/#list-issues-for-a-repository @param string $milestone @param string $state @param string $assignee @param string $creator @param string $mentioned @param string $labels @param string $sort @param string $direction @param string $since @return array
[ "List", "issues", "for", "a", "repository" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Issues.php#L130-L148
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Issues.php
Issues.createIssue
public function createIssue(string $title, string $body = '', string $assignee = '', int $milestone = 0, array $labels = []): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues', $this->getOwner(), $this->getRepo()), Request::METHOD_POST, [ 'title' => $title, 'body' => $body, 'assignee' => $assignee, 'milestone' => $milestone, 'labels' => $labels ]); }
php
public function createIssue(string $title, string $body = '', string $assignee = '', int $milestone = 0, array $labels = []): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues', $this->getOwner(), $this->getRepo()), Request::METHOD_POST, [ 'title' => $title, 'body' => $body, 'assignee' => $assignee, 'milestone' => $milestone, 'labels' => $labels ]); }
[ "public", "function", "createIssue", "(", "string", "$", "title", ",", "string", "$", "body", "=", "''", ",", "string", "$", "assignee", "=", "''", ",", "int", "$", "milestone", "=", "0", ",", "array", "$", "labels", "=", "[", "]", ")", ":", "array...
Create an issue @link https://developer.github.com/v3/issues/#create-an-issue @param string $title @param string $body @param string $assignee @param int $milestone @param array $labels @return array
[ "Create", "an", "issue" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Issues.php#L179-L190
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Issues.php
Issues.editIssue
public function editIssue(int $number, string $title = '', string $body = '', string $assignee = '', int $milestone = 0, array $labels = []): array { return $this->getApi()->request($this->getApi() ->sprintf('/repos/:owner/:repo/issues/:number', $this->getOwner(), $this->getRepo(), $number), Request::METHOD_PATCH, [ 'title' => $title, 'body' => $body, 'assignee' => $assignee, 'milestone' => $milestone, 'labels' => $labels ]); }
php
public function editIssue(int $number, string $title = '', string $body = '', string $assignee = '', int $milestone = 0, array $labels = []): array { return $this->getApi()->request($this->getApi() ->sprintf('/repos/:owner/:repo/issues/:number', $this->getOwner(), $this->getRepo(), $number), Request::METHOD_PATCH, [ 'title' => $title, 'body' => $body, 'assignee' => $assignee, 'milestone' => $milestone, 'labels' => $labels ]); }
[ "public", "function", "editIssue", "(", "int", "$", "number", ",", "string", "$", "title", "=", "''", ",", "string", "$", "body", "=", "''", ",", "string", "$", "assignee", "=", "''", ",", "int", "$", "milestone", "=", "0", ",", "array", "$", "labe...
Edit an issue @link https://developer.github.com/v3/issues/#edit-an-issue @param int $number @param string $title @param string $body @param string $assignee @param int $milestone @param array $labels @return array
[ "Edit", "an", "issue" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Issues.php#L206-L218
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Miscellaneous/Licenses.php
Licenses.getIndividualLicense
public function getIndividualLicense(string $license): array { return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request($this->getApi() ->sprintf('/licenses/:license', $license)); }
php
public function getIndividualLicense(string $license): array { return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request($this->getApi() ->sprintf('/licenses/:license', $license)); }
[ "public", "function", "getIndividualLicense", "(", "string", "$", "license", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "setAccept", "(", "'application/vnd.github.drax-preview+json'", ")", "->", "request", "(", "$", "this", ...
Get an individual license @link https://developer.github.com/v3/licenses/#get-an-individual-license @param string $license @return array
[ "Get", "an", "individual", "license" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Miscellaneous/Licenses.php#L34-L39
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Gists/Comments.php
Comments.listComments
public function listComments(string $gistId): array { return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments', $gistId)); }
php
public function listComments(string $gistId): array { return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments', $gistId)); }
[ "public", "function", "listComments", "(", "string", "$", "gistId", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/gists/:gist_id/comments'", ...
List comments on a gist @link https://developer.github.com/v3/gists/comments/#list-comments-on-a-gist @param string $gistId @return array
[ "List", "comments", "on", "a", "gist" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Gists/Comments.php#L24-L27
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/GitData/Commits.php
Commits.create
public function create(string $message, string $tree, $parents, string $name = null, string $email = null, string $date = 'now'): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/commits', $this->getGitData()->getOwner(), $this->getGitData()->getRepo()), Request::METHOD_POST, [ 'message' => $message, 'tree' => $tree, 'parents' => $parents, 'name' => $name, 'email' => $email, 'date' => (new DateTime($date))->format(DateTime::ATOM) ]); }
php
public function create(string $message, string $tree, $parents, string $name = null, string $email = null, string $date = 'now'): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/commits', $this->getGitData()->getOwner(), $this->getGitData()->getRepo()), Request::METHOD_POST, [ 'message' => $message, 'tree' => $tree, 'parents' => $parents, 'name' => $name, 'email' => $email, 'date' => (new DateTime($date))->format(DateTime::ATOM) ]); }
[ "public", "function", "create", "(", "string", "$", "message", ",", "string", "$", "tree", ",", "$", "parents", ",", "string", "$", "name", "=", "null", ",", "string", "$", "email", "=", "null", ",", "string", "$", "date", "=", "'now'", ")", ":", "...
Create a Commit @link https://developer.github.com/v3/git/commits/#create-a-commit @param string $message @param string $tree @param array|string $parents @param string $name @param string $email @param string $date @return array @throws \Exception
[ "Create", "a", "Commit" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/GitData/Commits.php#L46-L58
train
FlexyProject/GitHubAPI
lib/GitHub/Event/Payload.php
Payload.setSecret
public function setSecret(string $secret): Payload { $this->secret = hash_hmac('sha1', $this->rawData, $secret); return $this; }
php
public function setSecret(string $secret): Payload { $this->secret = hash_hmac('sha1', $this->rawData, $secret); return $this; }
[ "public", "function", "setSecret", "(", "string", "$", "secret", ")", ":", "Payload", "{", "$", "this", "->", "secret", "=", "hash_hmac", "(", "'sha1'", ",", "$", "this", "->", "rawData", ",", "$", "secret", ")", ";", "return", "$", "this", ";", "}" ...
Set secret, encode this secret with Hmac, SHA1 method @param string $secret @return Payload
[ "Set", "secret", "encode", "this", "secret", "with", "Hmac", "SHA1", "method" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Event/Payload.php#L76-L81
train
FlexyProject/GitHubAPI
lib/GitHub/Event/Payload.php
Payload.parse
public function parse(): Payload { /** Check signature from header */ if (!$this->_checkSignature()) { throw new BadSignatureException('Hook secret does not match.'); } /** Get data from different locations according to content-type */ switch ($this->serverBag->get('CONTENT_TYPE')) { case 'application/json': $data = $this->getRawData(); break; case 'application/x-www-form-urlencoded': $data = $_POST['payload']; break; default: throw new Exception('Unsupported content type: "' . $this->serverBag->get('CONTENT_TYPE') . '"'); } $this->setParsedData($data); return $this; }
php
public function parse(): Payload { /** Check signature from header */ if (!$this->_checkSignature()) { throw new BadSignatureException('Hook secret does not match.'); } /** Get data from different locations according to content-type */ switch ($this->serverBag->get('CONTENT_TYPE')) { case 'application/json': $data = $this->getRawData(); break; case 'application/x-www-form-urlencoded': $data = $_POST['payload']; break; default: throw new Exception('Unsupported content type: "' . $this->serverBag->get('CONTENT_TYPE') . '"'); } $this->setParsedData($data); return $this; }
[ "public", "function", "parse", "(", ")", ":", "Payload", "{", "/** Check signature from header */", "if", "(", "!", "$", "this", "->", "_checkSignature", "(", ")", ")", "{", "throw", "new", "BadSignatureException", "(", "'Hook secret does not match.'", ")", ";", ...
Parse raw data @return Payload @throws BadSignatureException @throws \Exception
[ "Parse", "raw", "data" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Event/Payload.php#L164-L187
train
FlexyProject/GitHubAPI
lib/GitHub/Event/Payload.php
Payload._checkSignature
private function _checkSignature(): bool { $secret = $this->getSecret(); $httpHubSignature = $this->serverBag->get('HTTP_X_HUB_SIGNATURE'); if (null !== $secret) { if ($httpHubSignature) { /** * Split signature into algorithm and hash * * @link http://isometriks.com/verify-github-webhooks-with-php */ list(, $hash) = explode('=', $httpHubSignature, 2); return $secret == $hash; } throw new BadSignatureException('HTTP header "X-Hub-Signature" is missing.'); } return true; }
php
private function _checkSignature(): bool { $secret = $this->getSecret(); $httpHubSignature = $this->serverBag->get('HTTP_X_HUB_SIGNATURE'); if (null !== $secret) { if ($httpHubSignature) { /** * Split signature into algorithm and hash * * @link http://isometriks.com/verify-github-webhooks-with-php */ list(, $hash) = explode('=', $httpHubSignature, 2); return $secret == $hash; } throw new BadSignatureException('HTTP header "X-Hub-Signature" is missing.'); } return true; }
[ "private", "function", "_checkSignature", "(", ")", ":", "bool", "{", "$", "secret", "=", "$", "this", "->", "getSecret", "(", ")", ";", "$", "httpHubSignature", "=", "$", "this", "->", "serverBag", "->", "get", "(", "'HTTP_X_HUB_SIGNATURE'", ")", ";", "...
Check X-Hub-Signature @throws BadSignatureException @return bool
[ "Check", "X", "-", "Hub", "-", "Signature" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Event/Payload.php#L195-L216
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Users/Followers.php
Followers.listFollowers
public function listFollowers(string $username = null): array { $url = '/user/followers'; if (null !== $username) { $url = $this->getApi()->sprintf('/users/:username/followers', $username); } return $this->getApi()->request($url); }
php
public function listFollowers(string $username = null): array { $url = '/user/followers'; if (null !== $username) { $url = $this->getApi()->sprintf('/users/:username/followers', $username); } return $this->getApi()->request($url); }
[ "public", "function", "listFollowers", "(", "string", "$", "username", "=", "null", ")", ":", "array", "{", "$", "url", "=", "'/user/followers'", ";", "if", "(", "null", "!==", "$", "username", ")", "{", "$", "url", "=", "$", "this", "->", "getApi", ...
List followers of a user @link https://developer.github.com/v3/users/followers/#list-followers-of-a-user @param null|string $username @return array @throws \Exception
[ "List", "followers", "of", "a", "user" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Users/Followers.php#L25-L33
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Users/Followers.php
Followers.checkFollowingUser
public function checkFollowingUser(string $username): bool { $this->getApi()->request($this->getApi()->sprintf('/user/following/:username', $username)); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
php
public function checkFollowingUser(string $username): bool { $this->getApi()->request($this->getApi()->sprintf('/user/following/:username', $username)); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
[ "public", "function", "checkFollowingUser", "(", "string", "$", "username", ")", ":", "bool", "{", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/user/following/:username'", ",",...
Check if you are following a user @link https://developer.github.com/v3/users/followers/#check-if-you-are-following-a-user @param string $username @return bool @throws \Exception
[ "Check", "if", "you", "are", "following", "a", "user" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Users/Followers.php#L65-L74
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Users/Followers.php
Followers.checkUserFollowsAnother
public function checkUserFollowsAnother(string $username, string $targetUser): bool { $this->getApi()->request($this->getApi() ->sprintf('/users/:username/following/:target_user', $username, $targetUser)); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
php
public function checkUserFollowsAnother(string $username, string $targetUser): bool { $this->getApi()->request($this->getApi() ->sprintf('/users/:username/following/:target_user', $username, $targetUser)); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
[ "public", "function", "checkUserFollowsAnother", "(", "string", "$", "username", ",", "string", "$", "targetUser", ")", ":", "bool", "{", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf",...
Check if one user follows another @link https://developer.github.com/v3/users/followers/#check-if-one-user-follows-another @param string $username @param string $targetUser @return bool @throws \Exception
[ "Check", "if", "one", "user", "follows", "another" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Users/Followers.php#L87-L97
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/Statuses.php
Statuses.createStatus
public function createStatus(string $sha, string $state, string $targetUrl = null, string $description = null, string $context = 'default'): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/statuses/:sha', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $sha), Request::METHOD_POST, [ 'state' => $state, 'target_url' => $targetUrl, 'description' => $description, 'context' => $context ]); }
php
public function createStatus(string $sha, string $state, string $targetUrl = null, string $description = null, string $context = 'default'): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/statuses/:sha', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $sha), Request::METHOD_POST, [ 'state' => $state, 'target_url' => $targetUrl, 'description' => $description, 'context' => $context ]); }
[ "public", "function", "createStatus", "(", "string", "$", "sha", ",", "string", "$", "state", ",", "string", "$", "targetUrl", "=", "null", ",", "string", "$", "description", "=", "null", ",", "string", "$", "context", "=", "'default'", ")", ":", "array"...
Create a Status @link https://developer.github.com/v3/repos/statuses/#create-a-status @param string $sha @param string $state @param string $targetUrl @param string $description @param string $context @return array
[ "Create", "a", "Status" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Statuses.php#L28-L38
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/PullRequests.php
PullRequests.getSinglePullRequest
public function getSinglePullRequest(int $number): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number', $this->getOwner(), $this->getRepo(), $number)); }
php
public function getSinglePullRequest(int $number): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number', $this->getOwner(), $this->getRepo(), $number)); }
[ "public", "function", "getSinglePullRequest", "(", "int", "$", "number", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/pulls...
Get a single pull request @link https://developer.github.com/v3/pulls/#get-a-single-pull-request @param int $number @return array @throws \Exception
[ "Get", "a", "single", "pull", "request" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/PullRequests.php#L58-L62
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/PullRequests/ReviewComments.php
ReviewComments.listCommentsPullRequest
public function listCommentsPullRequest(int $number): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number/comments', $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number)); }
php
public function listCommentsPullRequest(int $number): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number/comments', $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number)); }
[ "public", "function", "listCommentsPullRequest", "(", "int", "$", "number", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/pu...
List comments on a pull request @link https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request @param int $number @return array @throws \Exception
[ "List", "comments", "on", "a", "pull", "request" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/PullRequests/ReviewComments.php#L27-L31
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories.php
Repositories.listYourRepositories
public function listYourRepositories(string $type = AbstractApi::TYPE_ALL, string $sort = AbstractApi::SORT_FULL_NAME, string $direction = AbstractApi::DIRECTION_DESC): array { return $this->getApi()->request($this->getApi()->sprintf('/user/repos?:args', http_build_query(['type' => $type, 'sort' => $sort, 'direction' => $direction]))); }
php
public function listYourRepositories(string $type = AbstractApi::TYPE_ALL, string $sort = AbstractApi::SORT_FULL_NAME, string $direction = AbstractApi::DIRECTION_DESC): array { return $this->getApi()->request($this->getApi()->sprintf('/user/repos?:args', http_build_query(['type' => $type, 'sort' => $sort, 'direction' => $direction]))); }
[ "public", "function", "listYourRepositories", "(", "string", "$", "type", "=", "AbstractApi", "::", "TYPE_ALL", ",", "string", "$", "sort", "=", "AbstractApi", "::", "SORT_FULL_NAME", ",", "string", "$", "direction", "=", "AbstractApi", "::", "DIRECTION_DESC", "...
List repositories for the authenticated user. @link https://developer.github.com/v3/repos/#list-your-repositories @param string $type @param string $sort @param string $direction @return array
[ "List", "repositories", "for", "the", "authenticated", "user", "." ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories.php#L42-L48
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories.php
Repositories.listOrganizationRepositories
public function listOrganizationRepositories(string $organization, string $type = AbstractApi::TYPE_ALL): array { return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/repos?:args', $organization, http_build_query(['type' => $type]))); }
php
public function listOrganizationRepositories(string $organization, string $type = AbstractApi::TYPE_ALL): array { return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/repos?:args', $organization, http_build_query(['type' => $type]))); }
[ "public", "function", "listOrganizationRepositories", "(", "string", "$", "organization", ",", "string", "$", "type", "=", "AbstractApi", "::", "TYPE_ALL", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", ...
List repositories for the specified org. @link https://developer.github.com/v3/repos/#list-organization-repositories @param string $organization @param string $type @return array
[ "List", "repositories", "for", "the", "specified", "org", "." ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories.php#L80-L84
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories.php
Repositories.listPublicRepositories
public function listPublicRepositories(string $since = '1970-01-01'): array { return $this->getApi()->request($this->getApi() ->sprintf('/repositories?:arg', http_build_query(['since', $since]))); }
php
public function listPublicRepositories(string $since = '1970-01-01'): array { return $this->getApi()->request($this->getApi() ->sprintf('/repositories?:arg', http_build_query(['since', $since]))); }
[ "public", "function", "listPublicRepositories", "(", "string", "$", "since", "=", "'1970-01-01'", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", ...
List all public repositories @link https://developer.github.com/v3/repos/#list-all-public-repositories @param string $since @return array
[ "List", "all", "public", "repositories" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories.php#L95-L99
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories.php
Repositories.createRepository
public function createRepository(string $name, string $description = '', string $homepage = '', bool $private = false, bool $hasIssues = true, bool $hasWiki = true, bool $hasDownloads = true, int $teamId = 0, bool $autoInit = false, string $gitignoreTemplate = '', string $licenseTemplate = ''): array { return $this->getApi()->request(sprintf('/user/repos'), Request::METHOD_POST, [ 'name' => $name, 'description' => $description, 'homepage' => $homepage, 'private' => $private, 'has_issues' => $hasIssues, 'has_wiki' => $hasWiki, 'has_downloads' => $hasDownloads, 'team_id' => $teamId, 'auto_init' => $autoInit, 'gitignore_template' => $gitignoreTemplate, 'license_template' => $licenseTemplate ]); }
php
public function createRepository(string $name, string $description = '', string $homepage = '', bool $private = false, bool $hasIssues = true, bool $hasWiki = true, bool $hasDownloads = true, int $teamId = 0, bool $autoInit = false, string $gitignoreTemplate = '', string $licenseTemplate = ''): array { return $this->getApi()->request(sprintf('/user/repos'), Request::METHOD_POST, [ 'name' => $name, 'description' => $description, 'homepage' => $homepage, 'private' => $private, 'has_issues' => $hasIssues, 'has_wiki' => $hasWiki, 'has_downloads' => $hasDownloads, 'team_id' => $teamId, 'auto_init' => $autoInit, 'gitignore_template' => $gitignoreTemplate, 'license_template' => $licenseTemplate ]); }
[ "public", "function", "createRepository", "(", "string", "$", "name", ",", "string", "$", "description", "=", "''", ",", "string", "$", "homepage", "=", "''", ",", "bool", "$", "private", "=", "false", ",", "bool", "$", "hasIssues", "=", "true", ",", "...
Create a new repository for the authenticated user. @link https://developer.github.com/v3/repos/#create @param string $name @param string $description @param string $homepage @param bool $private @param bool $hasIssues @param bool $hasWiki @param bool $hasDownloads @param int $teamId @param bool $autoInit @param string $gitignoreTemplate @param string $licenseTemplate @return array
[ "Create", "a", "new", "repository", "for", "the", "authenticated", "user", "." ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories.php#L120-L138
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories.php
Repositories.deleteRepository
public function deleteRepository(): array { return $this->getApi()->request($this->getApi() ->sprintf('/repos/:owner/:repo', $this->getOwner(), $this->getRepo()), Request::METHOD_DELETE); }
php
public function deleteRepository(): array { return $this->getApi()->request($this->getApi() ->sprintf('/repos/:owner/:repo', $this->getOwner(), $this->getRepo()), Request::METHOD_DELETE); }
[ "public", "function", "deleteRepository", "(", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo'", ",", "$", "this", "->", ...
Delete a Repository @link https://developer.github.com/v3/repos/#delete-a-repository @return array
[ "Delete", "a", "Repository" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories.php#L315-L320
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories.php
Repositories.getRepositoryLicenseContent
public function getRepositoryLicenseContent(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/license', $this->getOwner(), $this->getRepo())); }
php
public function getRepositoryLicenseContent(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/license', $this->getOwner(), $this->getRepo())); }
[ "public", "function", "getRepositoryLicenseContent", "(", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/license'", ",", "$", ...
Get the contents of a repository's license @link https://developer.github.com/v3/licenses/#get-the-contents-of-a-repositorys-license @return array
[ "Get", "the", "contents", "of", "a", "repository", "s", "license" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories.php#L328-L332
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/GitData/Trees.php
Trees.get
public function get(string $sha): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/trees/:sha', $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); }
php
public function get(string $sha): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/trees/:sha', $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); }
[ "public", "function", "get", "(", "string", "$", "sha", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/git/trees/:sha'", ",...
Get a Tree @link https://developer.github.com/v3/git/trees/#get-a-tree @param string $sha @return array @throws \Exception
[ "Get", "a", "Tree" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/GitData/Trees.php#L25-L29
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/GitData/Trees.php
Trees.create
public function create(array $tree, string $base_tree): array { return $this->getApi()->request($this->getApi() ->sprintf('/repos/:owner/:repo/git/trees', $this->getGitData()->getOwner(), $this->getGitData()->getRepo()), Request::METHOD_POST, [ 'tree' => $tree, 'base_tree' => $base_tree ]); }
php
public function create(array $tree, string $base_tree): array { return $this->getApi()->request($this->getApi() ->sprintf('/repos/:owner/:repo/git/trees', $this->getGitData()->getOwner(), $this->getGitData()->getRepo()), Request::METHOD_POST, [ 'tree' => $tree, 'base_tree' => $base_tree ]); }
[ "public", "function", "create", "(", "array", "$", "tree", ",", "string", "$", "base_tree", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", ...
Create a Tree @link https://developer.github.com/v3/git/trees/#create-a-tree @param array $tree @param string $base_tree @return array @throws \Exception
[ "Create", "a", "Tree" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/GitData/Trees.php#L58-L66
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Enterprise/Ldap.php
Ldap.updateMappingUser
public function updateMappingUser(string $username): array { return $this->getApi()->request($this->getApi()->sprintf('/admin/ldap/user/:username/mapping', $username), Request::METHOD_PATCH); }
php
public function updateMappingUser(string $username): array { return $this->getApi()->request($this->getApi()->sprintf('/admin/ldap/user/:username/mapping', $username), Request::METHOD_PATCH); }
[ "public", "function", "updateMappingUser", "(", "string", "$", "username", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/admin/ldap/user/:usern...
Update LDAP mapping for a user @link https://developer.github.com/v3/enterprise/ldap/#update-ldap-mapping-for-a-user @param string $username @return array @throws Exception
[ "Update", "LDAP", "mapping", "for", "a", "user" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Enterprise/Ldap.php#L28-L32
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Enterprise/Ldap.php
Ldap.syncMappingUser
public function syncMappingUser(int $userId): array { return $this->getApi()->request($this->getApi()->sprintf('/admin/ldap/user/:user_id/sync', (string)$userId), Request::METHOD_POST); }
php
public function syncMappingUser(int $userId): array { return $this->getApi()->request($this->getApi()->sprintf('/admin/ldap/user/:user_id/sync', (string)$userId), Request::METHOD_POST); }
[ "public", "function", "syncMappingUser", "(", "int", "$", "userId", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/admin/ldap/user/:user_id/sync...
Sync LDAP mapping for a user @link https://developer.github.com/v3/enterprise/ldap/#sync-ldap-mapping-for-a-user @param int $userId @return array @throws Exception
[ "Sync", "LDAP", "mapping", "for", "a", "user" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Enterprise/Ldap.php#L44-L48
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Enterprise/Ldap.php
Ldap.updateMappingTeam
public function updateMappingTeam(int $teamId): array { return $this->getApi()->request($this->getApi()->sprintf('/admin/ldap/teams/:team_id/mapping', (string)$teamId), Request::METHOD_PATCH); }
php
public function updateMappingTeam(int $teamId): array { return $this->getApi()->request($this->getApi()->sprintf('/admin/ldap/teams/:team_id/mapping', (string)$teamId), Request::METHOD_PATCH); }
[ "public", "function", "updateMappingTeam", "(", "int", "$", "teamId", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/admin/ldap/teams/:team_id/m...
Update LDAP mapping for a team @link https://developer.github.com/v3/enterprise/ldap/#update-ldap-mapping-for-a-team @param int $teamId @return array @throws Exception
[ "Update", "LDAP", "mapping", "for", "a", "team" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Enterprise/Ldap.php#L60-L64
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Enterprise/Ldap.php
Ldap.syncMappingTeam
public function syncMappingTeam(int $teamId): array { return $this->getApi()->request($this->getApi()->sprintf('/admin/ldap/teams/:team_id/sync', (string)$teamId), Request::METHOD_POST); }
php
public function syncMappingTeam(int $teamId): array { return $this->getApi()->request($this->getApi()->sprintf('/admin/ldap/teams/:team_id/sync', (string)$teamId), Request::METHOD_POST); }
[ "public", "function", "syncMappingTeam", "(", "int", "$", "teamId", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/admin/ldap/teams/:team_id/syn...
Sync LDAP mapping for a team @link https://developer.github.com/v3/enterprise/ldap/#sync-ldap-mapping-for-a-team @param int $teamId @return array @throws Exception
[ "Sync", "LDAP", "mapping", "for", "a", "team" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Enterprise/Ldap.php#L76-L80
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Gists.php
Gists.listGists
public function listGists(string $username = null, string $since = '1970-01-01'): array { $url = '/gists'; if (null !== $username) { $url = '/users/:username/gists'; } return $this->getApi()->request($this->getApi()->sprintf(':url?:arg', $url, $username, http_build_query(['since' => (new DateTime($since))->format(DateTime::ATOM)]))); }
php
public function listGists(string $username = null, string $since = '1970-01-01'): array { $url = '/gists'; if (null !== $username) { $url = '/users/:username/gists'; } return $this->getApi()->request($this->getApi()->sprintf(':url?:arg', $url, $username, http_build_query(['since' => (new DateTime($since))->format(DateTime::ATOM)]))); }
[ "public", "function", "listGists", "(", "string", "$", "username", "=", "null", ",", "string", "$", "since", "=", "'1970-01-01'", ")", ":", "array", "{", "$", "url", "=", "'/gists'", ";", "if", "(", "null", "!==", "$", "username", ")", "{", "$", "url...
List a user's gists @link https://developer.github.com/v3/gists/#list-a-users-gists @param string $username @param string $since @return array
[ "List", "a", "user", "s", "gists" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Gists.php#L29-L38
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Gists.php
Gists.getGist
public function getGist(string $id): array { return $this->getApi()->request($this->getApi()->sprintf('/gists/:id', $id)); }
php
public function getGist(string $id): array { return $this->getApi()->request($this->getApi()->sprintf('/gists/:id', $id)); }
[ "public", "function", "getGist", "(", "string", "$", "id", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/gists/:id'", ",", "$", "id", "...
Get a single gist @link https://developer.github.com/v3/gists/#get-a-single-gist @param string $id @return array
[ "Get", "a", "single", "gist" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Gists.php#L79-L82
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Gists.php
Gists.getGistRevision
public function getGistRevision(string $id, string $sha): array { return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/:sha', $id, $sha)); }
php
public function getGistRevision(string $id, string $sha): array { return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/:sha', $id, $sha)); }
[ "public", "function", "getGistRevision", "(", "string", "$", "id", ",", "string", "$", "sha", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", ...
Get a specific revision of a gist @link https://developer.github.com/v3/gists/#get-a-specific-revision-of-a-gist @param string $id @param string $sha @return array @throws \Exception
[ "Get", "a", "specific", "revision", "of", "a", "gist" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Gists.php#L95-L98
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Gists.php
Gists.editGist
public function editGist(string $id, string $description = '', array $files = [], string $content = '', string $filename = ''): array { return $this->getApi()->request($this->getApi()->sprintf('/gists/:id', $id), Request::METHOD_PATCH, [ 'description' => $description, 'files' => $files, 'content' => $content, 'filename' => $filename ]); }
php
public function editGist(string $id, string $description = '', array $files = [], string $content = '', string $filename = ''): array { return $this->getApi()->request($this->getApi()->sprintf('/gists/:id', $id), Request::METHOD_PATCH, [ 'description' => $description, 'files' => $files, 'content' => $content, 'filename' => $filename ]); }
[ "public", "function", "editGist", "(", "string", "$", "id", ",", "string", "$", "description", "=", "''", ",", "array", "$", "files", "=", "[", "]", ",", "string", "$", "content", "=", "''", ",", "string", "$", "filename", "=", "''", ")", ":", "arr...
Edit a gist @link https://developer.github.com/v3/gists/#edit-a-gist @param string $id @param string $description @param array $files @param string $content @param string $filename @return array
[ "Edit", "a", "gist" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Gists.php#L133-L142
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Gists.php
Gists.listGistsCommits
public function listGistsCommits(string $id): array { return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/commits', $id)); }
php
public function listGistsCommits(string $id): array { return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/commits', $id)); }
[ "public", "function", "listGistsCommits", "(", "string", "$", "id", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/gists/:id/commits'", ",", ...
List gist commits @link https://developer.github.com/v3/gists/#list-gist-commits @param string $id @return array
[ "List", "gist", "commits" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Gists.php#L153-L156
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Gists.php
Gists.starGist
public function starGist(string $id): bool { $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id), Request::METHOD_PUT); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
php
public function starGist(string $id): bool { $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id), Request::METHOD_PUT); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
[ "public", "function", "starGist", "(", "string", "$", "id", ")", ":", "bool", "{", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/gists/:id/star'", ",", "$", "id", ")", "...
Star a gist @link https://developer.github.com/v3/gists/#star-a-gist @param string $id @return bool
[ "Star", "a", "gist" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Gists.php#L167-L176
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Gists.php
Gists.checkGistIsStarred
public function checkGistIsStarred(string $id): bool { $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id)); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
php
public function checkGistIsStarred(string $id): bool { $this->getApi()->request($this->getApi()->sprintf('/gists/:id/star', $id)); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
[ "public", "function", "checkGistIsStarred", "(", "string", "$", "id", ")", ":", "bool", "{", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/gists/:id/star'", ",", "$", "id", ...
Check if a gist is starred @link https://developer.github.com/v3/gists/#check-if-a-gist-is-starred @param string $id @return bool
[ "Check", "if", "a", "gist", "is", "starred" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Gists.php#L207-L216
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Gists.php
Gists.forkGist
public function forkGist(string $id): array { return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/forks', $id), Request::METHOD_POST); }
php
public function forkGist(string $id): array { return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/forks', $id), Request::METHOD_POST); }
[ "public", "function", "forkGist", "(", "string", "$", "id", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/gists/:id/forks'", ",", "$", "i...
Fork a gist @link https://developer.github.com/v3/gists/#fork-a-gist @param string $id @return array
[ "Fork", "a", "gist" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Gists.php#L227-L230
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Gists.php
Gists.listGistForks
public function listGistForks(string $id): array { return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/forks', $id)); }
php
public function listGistForks(string $id): array { return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/forks', $id)); }
[ "public", "function", "listGistForks", "(", "string", "$", "id", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/gists/:id/forks'", ",", "$",...
List gist forks @link https://developer.github.com/v3/gists/#list-gist-forks @param string $id @return array
[ "List", "gist", "forks" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Gists.php#L241-L244
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Organizations/Hooks.php
Hooks.deleteHook
public function deleteHook(string $org, int $id): bool { $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks/:id', $org, (string)$id), Request::METHOD_DELETE); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
php
public function deleteHook(string $org, int $id): bool { $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks/:id', $org, (string)$id), Request::METHOD_DELETE); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
[ "public", "function", "deleteHook", "(", "string", "$", "org", ",", "int", "$", "id", ")", ":", "bool", "{", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/orgs/:org/hooks/...
Delete a hook @link https://developer.github.com/v3/orgs/hooks/#delete-a-hook @param string $org @param int $id @return bool @throws \Exception
[ "Delete", "a", "hook" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Organizations/Hooks.php#L130-L140
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/DeployKeys.php
DeployKeys.listDeployKeys
public function listDeployKeys(): array { return $this->getApi()->request($this->getApi() ->sprintf('/repos/:owner/:repo/keys', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); }
php
public function listDeployKeys(): array { return $this->getApi()->request($this->getApi() ->sprintf('/repos/:owner/:repo/keys', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); }
[ "public", "function", "listDeployKeys", "(", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/keys'", ",", "$", "this", "->",...
List deploy keys @link https://developer.github.com/v3/repos/keys/#list @return array
[ "List", "deploy", "keys" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/DeployKeys.php#L21-L26
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/DeployKeys.php
DeployKeys.addNewDeployKey
public function addNewDeployKey(string $title, string $key): array { return $this->getApi()->request($this->getApi() ->sprintf('/repos/:owner/:repo/keys', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, [ 'title' => $title, 'key' => $key ]); }
php
public function addNewDeployKey(string $title, string $key): array { return $this->getApi()->request($this->getApi() ->sprintf('/repos/:owner/:repo/keys', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, [ 'title' => $title, 'key' => $key ]); }
[ "public", "function", "addNewDeployKey", "(", "string", "$", "title", ",", "string", "$", "key", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(...
Add a new deploy key @link https://developer.github.com/v3/repos/keys/#create @param string $title @param string $key @return array
[ "Add", "a", "new", "deploy", "key" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/DeployKeys.php#L53-L61
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/DeployKeys.php
DeployKeys.removeDeployKey
public function removeDeployKey(int $id): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/keys/:id', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_DELETE); }
php
public function removeDeployKey(int $id): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/keys/:id', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id), Request::METHOD_DELETE); }
[ "public", "function", "removeDeployKey", "(", "int", "$", "id", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/keys/:id'", ...
Remove a deploy key @link https://developer.github.com/v3/repos/keys/#delete @param int $id @return array
[ "Remove", "a", "deploy", "key" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/DeployKeys.php#L72-L76
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/Comments.php
Comments.listComments
public function listComments(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); }
php
public function listComments(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); }
[ "public", "function", "listComments", "(", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/comments'", ",", "$", "this", "->...
List commit comments for a repository @link https://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository @return array
[ "List", "commit", "comments", "for", "a", "repository" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Comments.php#L21-L25
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/Comments.php
Comments.getCommitComment
public function getCommitComment(int $id): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments/:id', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), (string)$id)); }
php
public function getCommitComment(int $id): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments/:id', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), (string)$id)); }
[ "public", "function", "getCommitComment", "(", "int", "$", "id", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/comments/:id'...
Get a single commit comment @link https://developer.github.com/v3/repos/comments/#get-a-single-commit-comment @param int $id @return array
[ "Get", "a", "single", "commit", "comment" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Comments.php#L73-L77
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/Comments.php
Comments.updateCommitComment
public function updateCommitComment(int $id, string $body): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments/:id', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), (string)$id), Request::METHOD_PATCH, [ 'body' => $body ]); }
php
public function updateCommitComment(int $id, string $body): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments/:id', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), (string)$id), Request::METHOD_PATCH, [ 'body' => $body ]); }
[ "public", "function", "updateCommitComment", "(", "int", "$", "id", ",", "string", "$", "body", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "("...
Update a commit comment @link https://developer.github.com/v3/repos/comments/#update-a-commit-comment @param int $id @param string $body @return array @throws \Exception
[ "Update", "a", "commit", "comment" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Comments.php#L90-L97
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/Comments.php
Comments.deleteCommitComment
public function deleteCommitComment(int $id): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments/:id', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), (string)$id), Request::METHOD_DELETE); }
php
public function deleteCommitComment(int $id): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments/:id', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), (string)$id), Request::METHOD_DELETE); }
[ "public", "function", "deleteCommitComment", "(", "int", "$", "id", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/comments/:...
Delete a commit comment @link https://developer.github.com/v3/repos/comments/#delete-a-commit-comment @param int $id @return array
[ "Delete", "a", "commit", "comment" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Comments.php#L108-L113
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/Statistics.php
Statistics.listContributors
public function listContributors(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/contributors', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); }
php
public function listContributors(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/contributors', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); }
[ "public", "function", "listContributors", "(", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/stats/contributors'", ",", "$", ...
Get contributors list with additions, deletions, and commit counts @link https://developer.github.com/v3/repos/statistics/#contributors @return array
[ "Get", "contributors", "list", "with", "additions", "deletions", "and", "commit", "counts" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Statistics.php#L19-L23
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/Statistics.php
Statistics.getCommitActivity
public function getCommitActivity(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/commit_activity', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); }
php
public function getCommitActivity(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/commit_activity', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); }
[ "public", "function", "getCommitActivity", "(", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/stats/commit_activity'", ",", "$...
Get the last year of commit activity data @link https://developer.github.com/v3/repos/statistics/#commit-activity @return array
[ "Get", "the", "last", "year", "of", "commit", "activity", "data" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Statistics.php#L31-L35
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/Statistics.php
Statistics.getCodeFrequency
public function getCodeFrequency(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/code_frequency', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); }
php
public function getCodeFrequency(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/code_frequency', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); }
[ "public", "function", "getCodeFrequency", "(", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/stats/code_frequency'", ",", "$",...
Get the number of additions and deletions per week @link https://developer.github.com/v3/repos/statistics/#code-frequency @return array
[ "Get", "the", "number", "of", "additions", "and", "deletions", "per", "week" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Statistics.php#L43-L47
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/Statistics.php
Statistics.getParticipation
public function getParticipation(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/participation', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); }
php
public function getParticipation(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/participation', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); }
[ "public", "function", "getParticipation", "(", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/stats/participation'", ",", "$", ...
Get the weekly commit count for the repository owner and everyone else @link https://developer.github.com/v3/repos/statistics/#participation @return array
[ "Get", "the", "weekly", "commit", "count", "for", "the", "repository", "owner", "and", "everyone", "else" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Statistics.php#L55-L59
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/Statistics.php
Statistics.getPunchCard
public function getPunchCard(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/punch_card', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); }
php
public function getPunchCard(): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/punch_card', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); }
[ "public", "function", "getPunchCard", "(", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/stats/punch_card'", ",", "$", "this...
Get the number of commits per hour in each day @link https://developer.github.com/v3/repos/statistics/#punch-card @return array
[ "Get", "the", "number", "of", "commits", "per", "hour", "in", "each", "day" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Statistics.php#L67-L71
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Activity/Notifications.php
Notifications.viewThread
public function viewThread(int $id): array { return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id', (string)$id)); }
php
public function viewThread(int $id): array { return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id', (string)$id)); }
[ "public", "function", "viewThread", "(", "int", "$", "id", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/notifications/threads/:id'", ",", ...
View a single thread @link https://developer.github.com/v3/activity/notifications/#view-a-single-thread @param int $id @return array
[ "View", "a", "single", "thread" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Activity/Notifications.php#L108-L111
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Activity/Notifications.php
Notifications.markThreadAsRead
public function markThreadAsRead(int $id): array { return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id', (string)$id), Request::METHOD_PATCH); }
php
public function markThreadAsRead(int $id): array { return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id', (string)$id), Request::METHOD_PATCH); }
[ "public", "function", "markThreadAsRead", "(", "int", "$", "id", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/notifications/threads/:id'", "...
Mark a thread as read @link https://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read @param int $id @return array
[ "Mark", "a", "thread", "as", "read" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Activity/Notifications.php#L122-L126
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Activity/Notifications.php
Notifications.getThreadSubscription
public function getThreadSubscription(int $id): array { return $this->getApi()->request($this->getApi() ->sprintf('/notifications/threads/:id/subscription', (string)$id)); }
php
public function getThreadSubscription(int $id): array { return $this->getApi()->request($this->getApi() ->sprintf('/notifications/threads/:id/subscription', (string)$id)); }
[ "public", "function", "getThreadSubscription", "(", "int", "$", "id", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/notifications/threads/:id/s...
Get a Thread Subscription @link https://developer.github.com/v3/activity/notifications/#get-a-thread-subscription @param int $id @return array
[ "Get", "a", "Thread", "Subscription" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Activity/Notifications.php#L137-L141
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Activity/Notifications.php
Notifications.setThreadSubscription
public function setThreadSubscription(int $id, bool $subscribed = false, bool $ignored = false): array { return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id/subscription?:args', $id, http_build_query(['subscribed' => $subscribed, 'ignored' => $ignored])), Request::METHOD_PUT); }
php
public function setThreadSubscription(int $id, bool $subscribed = false, bool $ignored = false): array { return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id/subscription?:args', $id, http_build_query(['subscribed' => $subscribed, 'ignored' => $ignored])), Request::METHOD_PUT); }
[ "public", "function", "setThreadSubscription", "(", "int", "$", "id", ",", "bool", "$", "subscribed", "=", "false", ",", "bool", "$", "ignored", "=", "false", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "("...
Set a Thread Subscription @link https://developer.github.com/v3/activity/notifications/#set-a-thread-subscription @param int $id @param bool $subscribed @param bool $ignored @return array
[ "Set", "a", "Thread", "Subscription" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Activity/Notifications.php#L154-L158
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Miscellaneous/Markdown.php
Markdown.render
public function render(string $text, string $mode = AbstractApi::MODE_MARKDOWN, string $context = ''): array { return $this->getApi()->request('/markdown', Request::METHOD_POST, [ 'text' => $text, 'mode' => $mode, 'context' => $context ]); }
php
public function render(string $text, string $mode = AbstractApi::MODE_MARKDOWN, string $context = ''): array { return $this->getApi()->request('/markdown', Request::METHOD_POST, [ 'text' => $text, 'mode' => $mode, 'context' => $context ]); }
[ "public", "function", "render", "(", "string", "$", "text", ",", "string", "$", "mode", "=", "AbstractApi", "::", "MODE_MARKDOWN", ",", "string", "$", "context", "=", "''", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", ...
Render an arbitrary Markdown document @link https://developer.github.com/v3/markdown/#render-an-arbitrary-markdown-document @param string $text The Markdown text to render @param string $mode The rendering mode. @param string $context The repository context. Only taken into account when rendering as gfm @return array
[ "Render", "an", "arbitrary", "Markdown", "document" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Miscellaneous/Markdown.php#L27-L34
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Miscellaneous/Markdown.php
Markdown.renderRaw
public function renderRaw(string $string): array { return $this->getApi()->setContentType('text/plain') ->request('/markdown/raw', Request::METHOD_POST, ['file' => $string]); }
php
public function renderRaw(string $string): array { return $this->getApi()->setContentType('text/plain') ->request('/markdown/raw', Request::METHOD_POST, ['file' => $string]); }
[ "public", "function", "renderRaw", "(", "string", "$", "string", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "setContentType", "(", "'text/plain'", ")", "->", "request", "(", "'/markdown/raw'", ",", "Request", "::", "METH...
Render a Markdown document in raw mode @link https://developer.github.com/v3/markdown/#render-a-markdown-document-in-raw-mode @param string $string @return array
[ "Render", "a", "Markdown", "document", "in", "raw", "mode" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Miscellaneous/Markdown.php#L45-L49
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/Collaborators.php
Collaborators.checkUserIsACollaborator
public function checkUserIsACollaborator(string $username): bool { $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/collaborators/:username', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $username)); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
php
public function checkUserIsACollaborator(string $username): bool { $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/collaborators/:username', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $username)); if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { return true; } return false; }
[ "public", "function", "checkUserIsACollaborator", "(", "string", "$", "username", ")", ":", "bool", "{", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo/collabora...
Check if a user is a collaborator @link https://developer.github.com/v3/repos/collaborators/#get @param string $username @return bool
[ "Check", "if", "a", "user", "is", "a", "collaborator" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Collaborators.php#L36-L46
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/Collaborators.php
Collaborators.addUserAsCollaborator
public function addUserAsCollaborator(string $username): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/collaborators/:username', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $username), Request::METHOD_PUT); }
php
public function addUserAsCollaborator(string $username): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/collaborators/:username', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $username), Request::METHOD_PUT); }
[ "public", "function", "addUserAsCollaborator", "(", "string", "$", "username", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:repo...
Add user as a collaborator @link https://developer.github.com/v3/repos/collaborators/#add-collaborator @param string $username @return array
[ "Add", "user", "as", "a", "collaborator" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Collaborators.php#L57-L61
train
FlexyProject/GitHubAPI
lib/GitHub/Receiver/Repositories/Collaborators.php
Collaborators.removeUserAsCollaborator
public function removeUserAsCollaborator(string $username): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/collaborators/:username', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $username), Request::METHOD_DELETE); }
php
public function removeUserAsCollaborator(string $username): array { return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/collaborators/:username', $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $username), Request::METHOD_DELETE); }
[ "public", "function", "removeUserAsCollaborator", "(", "string", "$", "username", ")", ":", "array", "{", "return", "$", "this", "->", "getApi", "(", ")", "->", "request", "(", "$", "this", "->", "getApi", "(", ")", "->", "sprintf", "(", "'/repos/:owner/:r...
Remove user as a collaborator @link https://developer.github.com/v3/repos/collaborators/#remove-collaborator @param string $username @return array
[ "Remove", "user", "as", "a", "collaborator" ]
cb5044443daf138787a7feb9aa9bf50220a44fd6
https://github.com/FlexyProject/GitHubAPI/blob/cb5044443daf138787a7feb9aa9bf50220a44fd6/lib/GitHub/Receiver/Repositories/Collaborators.php#L72-L77
train
wa0x6e/php-resque-ex
lib/Redisent/RedisentCluster.php
RedisentCluster.nextNode
private function nextNode($needle) { $haystack = $this->nodes; while (count($haystack) > 2) { $try = floor(count($haystack) / 2); if ($haystack[$try] == $needle) { return $needle; } if ($needle < $haystack[$try]) { $haystack = array_slice($haystack, 0, $try + 1); } if ($needle > $haystack[$try]) { $haystack = array_slice($haystack, $try + 1); } } return $haystack[count($haystack)-1]; }
php
private function nextNode($needle) { $haystack = $this->nodes; while (count($haystack) > 2) { $try = floor(count($haystack) / 2); if ($haystack[$try] == $needle) { return $needle; } if ($needle < $haystack[$try]) { $haystack = array_slice($haystack, 0, $try + 1); } if ($needle > $haystack[$try]) { $haystack = array_slice($haystack, $try + 1); } } return $haystack[count($haystack)-1]; }
[ "private", "function", "nextNode", "(", "$", "needle", ")", "{", "$", "haystack", "=", "$", "this", "->", "nodes", ";", "while", "(", "count", "(", "$", "haystack", ")", ">", "2", ")", "{", "$", "try", "=", "floor", "(", "count", "(", "$", "hayst...
Routes to the proper server node @param integer $needle The hash value of the Redis command @return Redisent The Redisent object associated with the hash
[ "Routes", "to", "the", "proper", "server", "node" ]
108261d37e4c79d049b4443b0ec5eb1906fdfffe
https://github.com/wa0x6e/php-resque-ex/blob/108261d37e4c79d049b4443b0ec5eb1906fdfffe/lib/Redisent/RedisentCluster.php#L121-L136
train
wa0x6e/php-resque-ex
lib/Resque/Failure.php
Resque_Failure.getBackend
public static function getBackend() { if(self::$backend === null) { require dirname(__FILE__) . '/Failure/Redis.php'; self::$backend = 'Resque_Failure_Redis'; } return self::$backend; }
php
public static function getBackend() { if(self::$backend === null) { require dirname(__FILE__) . '/Failure/Redis.php'; self::$backend = 'Resque_Failure_Redis'; } return self::$backend; }
[ "public", "static", "function", "getBackend", "(", ")", "{", "if", "(", "self", "::", "$", "backend", "===", "null", ")", "{", "require", "dirname", "(", "__FILE__", ")", ".", "'/Failure/Redis.php'", ";", "self", "::", "$", "backend", "=", "'Resque_Failure...
Return an instance of the backend for saving job failures. @return object Instance of backend object.
[ "Return", "an", "instance", "of", "the", "backend", "for", "saving", "job", "failures", "." ]
108261d37e4c79d049b4443b0ec5eb1906fdfffe
https://github.com/wa0x6e/php-resque-ex/blob/108261d37e4c79d049b4443b0ec5eb1906fdfffe/lib/Resque/Failure.php#L37-L45
train
clean/phpdoc-md
src/Markdown/ClassInfo.php
ClassInfo.render
public function render() { $parser = new ClassParser($this->reflectionClass); $methods = $parser->getMethodsDetails(); ksort($methods); $this->setData( [ 'className' => $this->reflectionClass->getName(), 'classShortName' => $this->reflectionClass->getShortName(), 'methods' => $methods, 'classDescription' => $parser->getClassDescription(), 'interfaces' => $parser->getInterfaces(), 'parentClass' => $parser->getParentClassName(), 'inheritedMethods' => $parser->getInheritedMethods(), ] ); return parent::render(); }
php
public function render() { $parser = new ClassParser($this->reflectionClass); $methods = $parser->getMethodsDetails(); ksort($methods); $this->setData( [ 'className' => $this->reflectionClass->getName(), 'classShortName' => $this->reflectionClass->getShortName(), 'methods' => $methods, 'classDescription' => $parser->getClassDescription(), 'interfaces' => $parser->getInterfaces(), 'parentClass' => $parser->getParentClassName(), 'inheritedMethods' => $parser->getInheritedMethods(), ] ); return parent::render(); }
[ "public", "function", "render", "(", ")", "{", "$", "parser", "=", "new", "ClassParser", "(", "$", "this", "->", "reflectionClass", ")", ";", "$", "methods", "=", "$", "parser", "->", "getMethodsDetails", "(", ")", ";", "ksort", "(", "$", "methods", ")...
Renders markdown for class @return string
[ "Renders", "markdown", "for", "class" ]
738e6d89db0db1a7a1f3bc86ef2fe74897688eab
https://github.com/clean/phpdoc-md/blob/738e6d89db0db1a7a1f3bc86ef2fe74897688eab/src/Markdown/ClassInfo.php#L29-L47
train
wa0x6e/php-resque-ex
lib/Resque.php
Resque.redis
public static function redis() { // Detect when the PID of the current process has changed (from a fork, etc) // and force a reconnect to redis. $pid = getmypid(); if (self::$pid !== $pid) { self::$redis = null; self::$pid = $pid; } if (!is_null(self::$redis)) { return self::$redis; } $server = self::$redisServer; if (empty($server)) { $server = 'localhost:6379'; } if (is_array($server)) { require_once dirname(__FILE__) . '/Resque/RedisCluster.php'; self::$redis = new Resque_RedisCluster($server); } else { if (strpos($server, 'unix:') === false) { list($host, $port) = explode(':', $server); } else { $host = $server; $port = null; } require_once dirname(__FILE__) . '/Resque/Redis.php'; $redisInstance = new Resque_Redis($host, $port, self::$password); $redisInstance->prefix(self::$namespace); self::$redis = $redisInstance; } if (!empty(self::$redisDatabase)) { self::$redis->select(self::$redisDatabase); } return self::$redis; }
php
public static function redis() { // Detect when the PID of the current process has changed (from a fork, etc) // and force a reconnect to redis. $pid = getmypid(); if (self::$pid !== $pid) { self::$redis = null; self::$pid = $pid; } if (!is_null(self::$redis)) { return self::$redis; } $server = self::$redisServer; if (empty($server)) { $server = 'localhost:6379'; } if (is_array($server)) { require_once dirname(__FILE__) . '/Resque/RedisCluster.php'; self::$redis = new Resque_RedisCluster($server); } else { if (strpos($server, 'unix:') === false) { list($host, $port) = explode(':', $server); } else { $host = $server; $port = null; } require_once dirname(__FILE__) . '/Resque/Redis.php'; $redisInstance = new Resque_Redis($host, $port, self::$password); $redisInstance->prefix(self::$namespace); self::$redis = $redisInstance; } if (!empty(self::$redisDatabase)) { self::$redis->select(self::$redisDatabase); } return self::$redis; }
[ "public", "static", "function", "redis", "(", ")", "{", "// Detect when the PID of the current process has changed (from a fork, etc)", "// and force a reconnect to redis.", "$", "pid", "=", "getmypid", "(", ")", ";", "if", "(", "self", "::", "$", "pid", "!==", "$", "...
Return an instance of the Resque_Redis class instantiated for Resque. @return Resque_Redis Instance of Resque_Redis.
[ "Return", "an", "instance", "of", "the", "Resque_Redis", "class", "instantiated", "for", "Resque", "." ]
108261d37e4c79d049b4443b0ec5eb1906fdfffe
https://github.com/wa0x6e/php-resque-ex/blob/108261d37e4c79d049b4443b0ec5eb1906fdfffe/lib/Resque.php#L70-L110
train
wa0x6e/php-resque-ex
lib/Resque.php
Resque.removeItems
private static function removeItems($queue, $items = []) { $counter = 0; $originalQueue = 'queue:' . $queue; $tempQueue = $originalQueue . ':temp:' . time(); $requeueQueue = $tempQueue . ':requeue'; // move each item from original queue to temp queue and process it $finished = false; while (!$finished) { $string = self::redis()->rpoplpush($originalQueue, self::redis()->getPrefix() . $tempQueue); if (!empty($string)) { if (self::matchItem($string, $items)) { self::redis()->rpop($tempQueue); $counter++; } else { self::redis()->rpoplpush($tempQueue, self::redis()->getPrefix() . $requeueQueue); } } else { $finished = true; } } // move back from temp queue to original queue $finished = false; while (!$finished) { $string = self::redis()->rpoplpush($requeueQueue, self::redis()->getPrefix() . $originalQueue); if (empty($string)) { $finished = true; } } // remove temp queue and requeue queue self::redis()->del($requeueQueue); self::redis()->del($tempQueue); return $counter; }
php
private static function removeItems($queue, $items = []) { $counter = 0; $originalQueue = 'queue:' . $queue; $tempQueue = $originalQueue . ':temp:' . time(); $requeueQueue = $tempQueue . ':requeue'; // move each item from original queue to temp queue and process it $finished = false; while (!$finished) { $string = self::redis()->rpoplpush($originalQueue, self::redis()->getPrefix() . $tempQueue); if (!empty($string)) { if (self::matchItem($string, $items)) { self::redis()->rpop($tempQueue); $counter++; } else { self::redis()->rpoplpush($tempQueue, self::redis()->getPrefix() . $requeueQueue); } } else { $finished = true; } } // move back from temp queue to original queue $finished = false; while (!$finished) { $string = self::redis()->rpoplpush($requeueQueue, self::redis()->getPrefix() . $originalQueue); if (empty($string)) { $finished = true; } } // remove temp queue and requeue queue self::redis()->del($requeueQueue); self::redis()->del($tempQueue); return $counter; }
[ "private", "static", "function", "removeItems", "(", "$", "queue", ",", "$", "items", "=", "[", "]", ")", "{", "$", "counter", "=", "0", ";", "$", "originalQueue", "=", "'queue:'", ".", "$", "queue", ";", "$", "tempQueue", "=", "$", "originalQueue", ...
Remove Items from the queue Safely moving each item to a temporary queue before processing it If the Job matches, counts otherwise puts it in a requeue_queue which at the end eventually be copied back into the original queue @private @param string $queue The name of the queue @param array $items @return integer number of deleted items
[ "Remove", "Items", "from", "the", "queue", "Safely", "moving", "each", "item", "to", "a", "temporary", "queue", "before", "processing", "it", "If", "the", "Job", "matches", "counts", "otherwise", "puts", "it", "in", "a", "requeue_queue", "which", "at", "the"...
108261d37e4c79d049b4443b0ec5eb1906fdfffe
https://github.com/wa0x6e/php-resque-ex/blob/108261d37e4c79d049b4443b0ec5eb1906fdfffe/lib/Resque.php#L235-L273
train
mmucklo/email-parse
src/Parse.php
Parse.handleQuote
private function handleQuote(array &$emailAddress) { if ($emailAddress['quote_temp']) { $emailAddress['name_parsed'] .= $emailAddress['quote_temp']; $emailAddress['name_quoted'] = true; $emailAddress['quote_temp'] = ''; } elseif ($emailAddress['address_temp']) { $emailAddress['name_parsed'] .= $emailAddress['address_temp']; $emailAddress['name_quoted'] = $emailAddress['address_temp_quoted']; $emailAddress['address_temp_quoted'] = false; $emailAddress['address_temp'] = ''; if ($emailAddress['address_temp_period'] > 0) { $emailAddress['invalid'] = true; $emailAddress['invalid_reason'] = 'Periods within the name of an email address must appear in quotes, such as "John Q. Public" <john@qpublic.com>'; } } }
php
private function handleQuote(array &$emailAddress) { if ($emailAddress['quote_temp']) { $emailAddress['name_parsed'] .= $emailAddress['quote_temp']; $emailAddress['name_quoted'] = true; $emailAddress['quote_temp'] = ''; } elseif ($emailAddress['address_temp']) { $emailAddress['name_parsed'] .= $emailAddress['address_temp']; $emailAddress['name_quoted'] = $emailAddress['address_temp_quoted']; $emailAddress['address_temp_quoted'] = false; $emailAddress['address_temp'] = ''; if ($emailAddress['address_temp_period'] > 0) { $emailAddress['invalid'] = true; $emailAddress['invalid_reason'] = 'Periods within the name of an email address must appear in quotes, such as "John Q. Public" <john@qpublic.com>'; } } }
[ "private", "function", "handleQuote", "(", "array", "&", "$", "emailAddress", ")", "{", "if", "(", "$", "emailAddress", "[", "'quote_temp'", "]", ")", "{", "$", "emailAddress", "[", "'name_parsed'", "]", ".=", "$", "emailAddress", "[", "'quote_temp'", "]", ...
Handles the case of a quoted name @param array $emailAddress
[ "Handles", "the", "case", "of", "a", "quoted", "name" ]
106326e5760c9d1d05c3aa392c1a3fbba72bf9c1
https://github.com/mmucklo/email-parse/blob/106326e5760c9d1d05c3aa392c1a3fbba72bf9c1/src/Parse.php#L637-L653
train
mmucklo/email-parse
src/Parse.php
Parse.validateDomainName
protected function validateDomainName($domain, $encoding = 'UTF-8') { if (mb_strlen($domain, $encoding) > 255) { return ['valid' => false, 'reason' => 'Domain name too long']; } else { $origEncoding = mb_regex_encoding(); mb_regex_encoding($encoding); $parts = mb_split('\\.', $domain); mb_regex_encoding($origEncoding); foreach ($parts as $part) { if (mb_strlen($part, $encoding) > 63) { return ['valid' => false, 'reason' => "Domain name part '${part}' too long"]; } if (!preg_match('/^[a-zA-Z0-9\-]+$/', $part)) { return ['valid' => false, 'reason' => "Domain name '${domain}' can only contain letters a through z, numbers 0 through 9 and hyphen. The part '${part}' contains characters outside of that range."]; } if (mb_substr($part, 0, 1, $encoding) == '-' || mb_substr($part, mb_strlen($part) - 1, 1, $encoding) == '-') { return ['valid' => false, 'reason' => "Parts of the domain name '${domain}' can not start or end with '-'. This part does: ${part}"]; } } } // @TODO - possibly check DNS / MX records for domain to make sure it exists? return ['valid' => true]; }
php
protected function validateDomainName($domain, $encoding = 'UTF-8') { if (mb_strlen($domain, $encoding) > 255) { return ['valid' => false, 'reason' => 'Domain name too long']; } else { $origEncoding = mb_regex_encoding(); mb_regex_encoding($encoding); $parts = mb_split('\\.', $domain); mb_regex_encoding($origEncoding); foreach ($parts as $part) { if (mb_strlen($part, $encoding) > 63) { return ['valid' => false, 'reason' => "Domain name part '${part}' too long"]; } if (!preg_match('/^[a-zA-Z0-9\-]+$/', $part)) { return ['valid' => false, 'reason' => "Domain name '${domain}' can only contain letters a through z, numbers 0 through 9 and hyphen. The part '${part}' contains characters outside of that range."]; } if (mb_substr($part, 0, 1, $encoding) == '-' || mb_substr($part, mb_strlen($part) - 1, 1, $encoding) == '-') { return ['valid' => false, 'reason' => "Parts of the domain name '${domain}' can not start or end with '-'. This part does: ${part}"]; } } } // @TODO - possibly check DNS / MX records for domain to make sure it exists? return ['valid' => true]; }
[ "protected", "function", "validateDomainName", "(", "$", "domain", ",", "$", "encoding", "=", "'UTF-8'", ")", "{", "if", "(", "mb_strlen", "(", "$", "domain", ",", "$", "encoding", ")", ">", "255", ")", "{", "return", "[", "'valid'", "=>", "false", ","...
Determines whether the domain name is valid @param string $domain The domain name to validate @param string $encoding The encoding of the string (if not UTF-8) @return array array('valid' => boolean: whether valid or not, 'reason' => string: if not valid, the reason why);
[ "Determines", "whether", "the", "domain", "name", "is", "valid" ]
106326e5760c9d1d05c3aa392c1a3fbba72bf9c1
https://github.com/mmucklo/email-parse/blob/106326e5760c9d1d05c3aa392c1a3fbba72bf9c1/src/Parse.php#L804-L828
train
ua1-labs/firesql
Fire/Sql/Filter.php
Filter.where
public function where($propertyName) { $this->indexType(self::INDEX_SEARCH_TYPE_VALUE); return $this->_addComparison(new WhereExpression($propertyName)); }
php
public function where($propertyName) { $this->indexType(self::INDEX_SEARCH_TYPE_VALUE); return $this->_addComparison(new WhereExpression($propertyName)); }
[ "public", "function", "where", "(", "$", "propertyName", ")", "{", "$", "this", "->", "indexType", "(", "self", "::", "INDEX_SEARCH_TYPE_VALUE", ")", ";", "return", "$", "this", "->", "_addComparison", "(", "new", "WhereExpression", "(", "$", "propertyName", ...
Adds a WHERE logic operator to the search statement. @param string $propertyName The name of the property you would like to search on @return \Fire\Sql\Filter\LogicExpression
[ "Adds", "a", "WHERE", "logic", "operator", "to", "the", "search", "statement", "." ]
9c2a480ad16429e659ba9f476c27b73c9b5c9a06
https://github.com/ua1-labs/firesql/blob/9c2a480ad16429e659ba9f476c27b73c9b5c9a06/Fire/Sql/Filter.php#L116-L120
train
ua1-labs/firesql
Fire/Sql/Filter.php
Filter.filter
public function filter() { return (object) [ 'type' => $this->_indexType, 'filters' => $this->_comparisons, 'order' => $this->_orderBy, 'reverse' => $this->_reverse, 'offset' => $this->_offset, 'length' => $this->_length ]; }
php
public function filter() { return (object) [ 'type' => $this->_indexType, 'filters' => $this->_comparisons, 'order' => $this->_orderBy, 'reverse' => $this->_reverse, 'offset' => $this->_offset, 'length' => $this->_length ]; }
[ "public", "function", "filter", "(", ")", "{", "return", "(", "object", ")", "[", "'type'", "=>", "$", "this", "->", "_indexType", ",", "'filters'", "=>", "$", "this", "->", "_comparisons", ",", "'order'", "=>", "$", "this", "->", "_orderBy", ",", "'re...
Returns the filter model @return object
[ "Returns", "the", "filter", "model" ]
9c2a480ad16429e659ba9f476c27b73c9b5c9a06
https://github.com/ua1-labs/firesql/blob/9c2a480ad16429e659ba9f476c27b73c9b5c9a06/Fire/Sql/Filter.php#L251-L261
train
ua1-labs/firesql
Fire/Sql/Filter.php
Filter._addComparison
private function _addComparison(LogicExpression $logicExpression) { $this->_comparisons[] = $logicExpression; end($this->_comparisons); $i = key($this->_comparisons); return $this->_comparisons[$i]; }
php
private function _addComparison(LogicExpression $logicExpression) { $this->_comparisons[] = $logicExpression; end($this->_comparisons); $i = key($this->_comparisons); return $this->_comparisons[$i]; }
[ "private", "function", "_addComparison", "(", "LogicExpression", "$", "logicExpression", ")", "{", "$", "this", "->", "_comparisons", "[", "]", "=", "$", "logicExpression", ";", "end", "(", "$", "this", "->", "_comparisons", ")", ";", "$", "i", "=", "key",...
Used to add logic expressions to the _comparisons array. @param LogicExpression $logicExpression @return \Fire\Sql\Filter\LogicExpression
[ "Used", "to", "add", "logic", "expressions", "to", "the", "_comparisons", "array", "." ]
9c2a480ad16429e659ba9f476c27b73c9b5c9a06
https://github.com/ua1-labs/firesql/blob/9c2a480ad16429e659ba9f476c27b73c9b5c9a06/Fire/Sql/Filter.php#L268-L273
train
ua1-labs/firesql
Fire/Sql/Filter.php
Filter._addFilterComparison
private function _addFilterComparison($firstObj, $firstProperty, $property, $value) { if ($firstObj && $firstProperty) { $this->_parseComparison(self::COMPARISON_LOGIC_WHERE, $property, $value); } else if (!$firstObj && $firstProperty) { $this->_parseComparison(self::COMPARISON_LOGIC_OR, $property, $value); } else { $this->_parseComparison(self::COMPARISON_LOGIC_AND, $property, $value); } }
php
private function _addFilterComparison($firstObj, $firstProperty, $property, $value) { if ($firstObj && $firstProperty) { $this->_parseComparison(self::COMPARISON_LOGIC_WHERE, $property, $value); } else if (!$firstObj && $firstProperty) { $this->_parseComparison(self::COMPARISON_LOGIC_OR, $property, $value); } else { $this->_parseComparison(self::COMPARISON_LOGIC_AND, $property, $value); } }
[ "private", "function", "_addFilterComparison", "(", "$", "firstObj", ",", "$", "firstProperty", ",", "$", "property", ",", "$", "value", ")", "{", "if", "(", "$", "firstObj", "&&", "$", "firstProperty", ")", "{", "$", "this", "->", "_parseComparison", "(",...
Adds a comparison to the filter from the queryString @param boolean $firstObj @param boolean $firstProperty @param string $property @param mixed $value @return void
[ "Adds", "a", "comparison", "to", "the", "filter", "from", "the", "queryString" ]
9c2a480ad16429e659ba9f476c27b73c9b5c9a06
https://github.com/ua1-labs/firesql/blob/9c2a480ad16429e659ba9f476c27b73c9b5c9a06/Fire/Sql/Filter.php#L323-L332
train
ua1-labs/firesql
Fire/Sql/Filter.php
Filter._parseComparison
private function _parseComparison($compareLogic, $property, $value) { switch ($property) { case self::FILTER_CONFIG_LENGTH: $this->length($value); break; case self::FILTER_CONFIG_OFFSET: $this->offset($value); break; case self::FILTER_CONFIG_ORDER_BY: $this->orderBy($value); break; case self::FILTER_CONFIG_REVERSE: $this->reverse($value); break; default: $compare = $this->_extractComparisonTypeAndValue($value); $compareType = $compare->type; $compareValue = $compare->value; $this->{$compareLogic}($property)->{$compareType}($compareValue); } }
php
private function _parseComparison($compareLogic, $property, $value) { switch ($property) { case self::FILTER_CONFIG_LENGTH: $this->length($value); break; case self::FILTER_CONFIG_OFFSET: $this->offset($value); break; case self::FILTER_CONFIG_ORDER_BY: $this->orderBy($value); break; case self::FILTER_CONFIG_REVERSE: $this->reverse($value); break; default: $compare = $this->_extractComparisonTypeAndValue($value); $compareType = $compare->type; $compareValue = $compare->value; $this->{$compareLogic}($property)->{$compareType}($compareValue); } }
[ "private", "function", "_parseComparison", "(", "$", "compareLogic", ",", "$", "property", ",", "$", "value", ")", "{", "switch", "(", "$", "property", ")", "{", "case", "self", "::", "FILTER_CONFIG_LENGTH", ":", "$", "this", "->", "length", "(", "$", "v...
Parses comparisons and adds logic to the filter. @param string $compareLogic @param string $property @param mixed $value @return void
[ "Parses", "comparisons", "and", "adds", "logic", "to", "the", "filter", "." ]
9c2a480ad16429e659ba9f476c27b73c9b5c9a06
https://github.com/ua1-labs/firesql/blob/9c2a480ad16429e659ba9f476c27b73c9b5c9a06/Fire/Sql/Filter.php#L341-L362
train
ua1-labs/firesql
Fire/Sql/Filter.php
Filter._extractComparisonTypeAndValue
private function _extractComparisonTypeAndValue($val) { $validComparisons = [ self::COMPARISON_TYPE_GREATERTHAN_EQUAL, self::COMPARISON_TYPE_LESSTHAN_EQUAL, self::COMPARISON_TYPE_NOT_EQUAL, self::COMPARISON_TYPE_GREATERTHAN, self::COMPARISON_TYPE_LESSTHAN, self::METHOD_LOGIC_TYPE_EQUAL ]; $comparison = substr($val, 0, 2); switch ($comparison) { case self::COMPARISON_TYPE_GREATERTHAN_EQUAL: $type = self::METHOD_LOGIC_TYPE_GREATERTHAN_EQUAL; break; case self::COMPARISON_TYPE_LESSTHAN_EQUAL: $type = self::METHOD_LOGIC_TYPE_LESSTHAN_EQUAL; break; case self::COMPARISON_TYPE_NOT_EQUAL: $type = self::METHOD_LOGIC_TYPE_NOT_EQUAL; break; } if (empty($type)) { $comparison = substr($val, 0, 1); switch ($comparison) { case self::COMPARISON_TYPE_GREATERTHAN: $type = self::METHOD_LOGIC_TYPE_GREATERTHAN; break; case self::COMPARISON_TYPE_LESSTHAN: $type = self::METHOD_LOGIC_TYPE_LESSTHAN; break; default: $type = self::METHOD_LOGIC_TYPE_EQUAL; } } return (object) [ 'type' => $type, 'value' => (is_string($val) && in_array($comparison, $validComparisons)) ? str_replace($comparison, '', $val) : $val ]; }
php
private function _extractComparisonTypeAndValue($val) { $validComparisons = [ self::COMPARISON_TYPE_GREATERTHAN_EQUAL, self::COMPARISON_TYPE_LESSTHAN_EQUAL, self::COMPARISON_TYPE_NOT_EQUAL, self::COMPARISON_TYPE_GREATERTHAN, self::COMPARISON_TYPE_LESSTHAN, self::METHOD_LOGIC_TYPE_EQUAL ]; $comparison = substr($val, 0, 2); switch ($comparison) { case self::COMPARISON_TYPE_GREATERTHAN_EQUAL: $type = self::METHOD_LOGIC_TYPE_GREATERTHAN_EQUAL; break; case self::COMPARISON_TYPE_LESSTHAN_EQUAL: $type = self::METHOD_LOGIC_TYPE_LESSTHAN_EQUAL; break; case self::COMPARISON_TYPE_NOT_EQUAL: $type = self::METHOD_LOGIC_TYPE_NOT_EQUAL; break; } if (empty($type)) { $comparison = substr($val, 0, 1); switch ($comparison) { case self::COMPARISON_TYPE_GREATERTHAN: $type = self::METHOD_LOGIC_TYPE_GREATERTHAN; break; case self::COMPARISON_TYPE_LESSTHAN: $type = self::METHOD_LOGIC_TYPE_LESSTHAN; break; default: $type = self::METHOD_LOGIC_TYPE_EQUAL; } } return (object) [ 'type' => $type, 'value' => (is_string($val) && in_array($comparison, $validComparisons)) ? str_replace($comparison, '', $val) : $val ]; }
[ "private", "function", "_extractComparisonTypeAndValue", "(", "$", "val", ")", "{", "$", "validComparisons", "=", "[", "self", "::", "COMPARISON_TYPE_GREATERTHAN_EQUAL", ",", "self", "::", "COMPARISON_TYPE_LESSTHAN_EQUAL", ",", "self", "::", "COMPARISON_TYPE_NOT_EQUAL", ...
Returns comparison value and type @param mixed $val @return object
[ "Returns", "comparison", "value", "and", "type" ]
9c2a480ad16429e659ba9f476c27b73c9b5c9a06
https://github.com/ua1-labs/firesql/blob/9c2a480ad16429e659ba9f476c27b73c9b5c9a06/Fire/Sql/Filter.php#L369-L411
train
yuan1994/ZCrawler
src/Schedule/School.php
School.parseHtml
public function parseHtml($html) { return Parser::table($html, '#DBGrid', [ 'status', 'name', 'credit', 'examination', 'property', 'teacher', 'code', 'week', ['hour', function (Crawler $crawler) { return $crawler->attr("title") ?: $crawler->text(); }], ['place', function (Crawler $crawler) { return $crawler->text() == ";" ? '' : ($crawler->attr("title") ?: $crawler->text()); }], 'campus', ['class', function (Crawler $crawler) { return $crawler->attr("title") ?: $crawler->text(); }], ], 12, 1, 'text'); }
php
public function parseHtml($html) { return Parser::table($html, '#DBGrid', [ 'status', 'name', 'credit', 'examination', 'property', 'teacher', 'code', 'week', ['hour', function (Crawler $crawler) { return $crawler->attr("title") ?: $crawler->text(); }], ['place', function (Crawler $crawler) { return $crawler->text() == ";" ? '' : ($crawler->attr("title") ?: $crawler->text()); }], 'campus', ['class', function (Crawler $crawler) { return $crawler->attr("title") ?: $crawler->text(); }], ], 12, 1, 'text'); }
[ "public", "function", "parseHtml", "(", "$", "html", ")", "{", "return", "Parser", "::", "table", "(", "$", "html", ",", "'#DBGrid'", ",", "[", "'status'", ",", "'name'", ",", "'credit'", ",", "'examination'", ",", "'property'", ",", "'teacher'", ",", "'...
Parse html to array @param string $html @return array
[ "Parse", "html", "to", "array" ]
46c48a7c1837e404c324811776fc60f7b2a80df6
https://github.com/yuan1994/ZCrawler/blob/46c48a7c1837e404c324811776fc60f7b2a80df6/src/Schedule/School.php#L28-L43
train
ua1-labs/firesql
Fire/Sql/Connector.php
Connector.exec
public function exec($sql) { // get start time of sql execution $start = $this->_firebug->timer(); // execute sql $this->_pdo->exec($sql); // record sql statement if ($this->_firebug->isEnabled()) { $trace = debug_backtrace(); $this->_recordSqlStatement($start, $sql, $trace); } }
php
public function exec($sql) { // get start time of sql execution $start = $this->_firebug->timer(); // execute sql $this->_pdo->exec($sql); // record sql statement if ($this->_firebug->isEnabled()) { $trace = debug_backtrace(); $this->_recordSqlStatement($start, $sql, $trace); } }
[ "public", "function", "exec", "(", "$", "sql", ")", "{", "// get start time of sql execution", "$", "start", "=", "$", "this", "->", "_firebug", "->", "timer", "(", ")", ";", "// execute sql", "$", "this", "->", "_pdo", "->", "exec", "(", "$", "sql", ")"...
Executes a SQL statement. This method is meant for executing SQL statements that manipulate data within the database. @param string $sql @return void
[ "Executes", "a", "SQL", "statement", ".", "This", "method", "is", "meant", "for", "executing", "SQL", "statements", "that", "manipulate", "data", "within", "the", "database", "." ]
9c2a480ad16429e659ba9f476c27b73c9b5c9a06
https://github.com/ua1-labs/firesql/blob/9c2a480ad16429e659ba9f476c27b73c9b5c9a06/Fire/Sql/Connector.php#L58-L68
train
ua1-labs/firesql
Fire/Sql/Connector.php
Connector.query
public function query($sql) { // get start time of sql execution $start = $this->_firebug->timer(); // execute sql $records = $this->_pdo->query($sql); // record sql statement if ($this->_firebug->isEnabled()) { $trace = debug_backtrace(); $this->_recordSqlStatement($start, $sql, $trace); } return $records; }
php
public function query($sql) { // get start time of sql execution $start = $this->_firebug->timer(); // execute sql $records = $this->_pdo->query($sql); // record sql statement if ($this->_firebug->isEnabled()) { $trace = debug_backtrace(); $this->_recordSqlStatement($start, $sql, $trace); } return $records; }
[ "public", "function", "query", "(", "$", "sql", ")", "{", "// get start time of sql execution", "$", "start", "=", "$", "this", "->", "_firebug", "->", "timer", "(", ")", ";", "// execute sql", "$", "records", "=", "$", "this", "->", "_pdo", "->", "query",...
Executes a SQL query. This meathod is meant for executing SQL queries that will return records. @param string $sql @return array
[ "Executes", "a", "SQL", "query", ".", "This", "meathod", "is", "meant", "for", "executing", "SQL", "queries", "that", "will", "return", "records", "." ]
9c2a480ad16429e659ba9f476c27b73c9b5c9a06
https://github.com/ua1-labs/firesql/blob/9c2a480ad16429e659ba9f476c27b73c9b5c9a06/Fire/Sql/Connector.php#L76-L89
train
ua1-labs/firesql
Fire/Sql/Connector.php
Connector._recordSqlStatement
private function _recordSqlStatement($start, $sql, $trace) { $sqlStatement = new SqlStatement(); $sqlStatement->setStatement($sql); $sqlStatement->setTime($this->_firebug->timer($start)); $sqlStatement->setTrace($trace); $this->_firebug ->getPanel(FireSqlPanel::ID) ->addSqlStatement($sqlStatement); }
php
private function _recordSqlStatement($start, $sql, $trace) { $sqlStatement = new SqlStatement(); $sqlStatement->setStatement($sql); $sqlStatement->setTime($this->_firebug->timer($start)); $sqlStatement->setTrace($trace); $this->_firebug ->getPanel(FireSqlPanel::ID) ->addSqlStatement($sqlStatement); }
[ "private", "function", "_recordSqlStatement", "(", "$", "start", ",", "$", "sql", ",", "$", "trace", ")", "{", "$", "sqlStatement", "=", "new", "SqlStatement", "(", ")", ";", "$", "sqlStatement", "->", "setStatement", "(", "$", "sql", ")", ";", "$", "s...
Records SQL statements to the FireBug Panel created to track SQL queries. @param float $start A timestamp created by FireBug::timer() @param string $sql The SQL Statement to Record @param array $trace The trace generated by debug_backtrace() @return void
[ "Records", "SQL", "statements", "to", "the", "FireBug", "Panel", "created", "to", "track", "SQL", "queries", "." ]
9c2a480ad16429e659ba9f476c27b73c9b5c9a06
https://github.com/ua1-labs/firesql/blob/9c2a480ad16429e659ba9f476c27b73c9b5c9a06/Fire/Sql/Connector.php#L109-L118
train
yuan1994/ZCrawler
src/Core/AbstractAPIBase.php
AbstractAPIBase.request
protected function request($method, array $args) { $http = $this->getHttp(); // If didn`t set $args then set $args to the empty array $args = array_replace(['', [], []], $args); // Set the cookies if (!isset($args[2]['cookies'])) { $args[2]['cookies'] = $this->getCookie(); // Set the query string xh $args[2]['query']['xh'] = $this->getUserName(); } // Set the proxy and cross the campus network vpn if (Config::get('proxy_status', false)) { $args[2]['proxy'] = Config::get('proxy', ''); } // Set the request headers if ($headers = Config::get('http_headers')) { $args[2]['headers'] = $headers; } // Get the viewstate field if (isset($args[1]['__VIEWSTATE']) && true === $args[1]['__VIEWSTATE']) { $args[1]['__VIEWSTATE'] = $this->getViewsState($args[0]); } // Set the uri prefix for the cookies in url $args[0] = Config::get('param.url_prefix', '') . $args[0]; // Try to get the response $response = call_user_func_array([$http, $method], $args); // Check whether need to request again with the url prefix $body = (string)$response->getBody(); // The case of "Object moved to <a href='/(palpi545qhgbee55fvfekz45)/path.aspx" retry to new uri if (preg_match('/Object\ moved\ to\ <a\ href=[\'"]?\/(\(\w+\))/i', $body, $matches)) { // Set the new retry request`s uri $uriPrefix = $matches[1] . '/'; Config::set('param.url_prefix', $uriPrefix); // Reset the request url path and request again $args[0] = $uriPrefix . $args[0]; $response = call_user_func_array([$http, $method], $args); } return $response; }
php
protected function request($method, array $args) { $http = $this->getHttp(); // If didn`t set $args then set $args to the empty array $args = array_replace(['', [], []], $args); // Set the cookies if (!isset($args[2]['cookies'])) { $args[2]['cookies'] = $this->getCookie(); // Set the query string xh $args[2]['query']['xh'] = $this->getUserName(); } // Set the proxy and cross the campus network vpn if (Config::get('proxy_status', false)) { $args[2]['proxy'] = Config::get('proxy', ''); } // Set the request headers if ($headers = Config::get('http_headers')) { $args[2]['headers'] = $headers; } // Get the viewstate field if (isset($args[1]['__VIEWSTATE']) && true === $args[1]['__VIEWSTATE']) { $args[1]['__VIEWSTATE'] = $this->getViewsState($args[0]); } // Set the uri prefix for the cookies in url $args[0] = Config::get('param.url_prefix', '') . $args[0]; // Try to get the response $response = call_user_func_array([$http, $method], $args); // Check whether need to request again with the url prefix $body = (string)$response->getBody(); // The case of "Object moved to <a href='/(palpi545qhgbee55fvfekz45)/path.aspx" retry to new uri if (preg_match('/Object\ moved\ to\ <a\ href=[\'"]?\/(\(\w+\))/i', $body, $matches)) { // Set the new retry request`s uri $uriPrefix = $matches[1] . '/'; Config::set('param.url_prefix', $uriPrefix); // Reset the request url path and request again $args[0] = $uriPrefix . $args[0]; $response = call_user_func_array([$http, $method], $args); } return $response; }
[ "protected", "function", "request", "(", "$", "method", ",", "array", "$", "args", ")", "{", "$", "http", "=", "$", "this", "->", "getHttp", "(", ")", ";", "// If didn`t set $args then set $args to the empty array", "$", "args", "=", "array_replace", "(", "[",...
Send a request with some options @param string $method @param array $args @return ResponseInterface
[ "Send", "a", "request", "with", "some", "options" ]
46c48a7c1837e404c324811776fc60f7b2a80df6
https://github.com/yuan1994/ZCrawler/blob/46c48a7c1837e404c324811776fc60f7b2a80df6/src/Core/AbstractAPIBase.php#L107-L147
train
ua1-labs/firesql
Fire/Sql/Collection.php
Collection.find
public function find($filter = null) { if (is_string($filter)) { json_decode($filter); $isJson = (json_last_error() === JSON_ERROR_NONE) ? true :false; if ($isJson) { $filter = new Filter($filter); return $this->_getObjectsByFilter($filter); } else { return $this->_getObject($filter); } } else if (is_object($filter) && $filter instanceof Filter) { return $this->_getObjectsByFilter($filter); } return []; }
php
public function find($filter = null) { if (is_string($filter)) { json_decode($filter); $isJson = (json_last_error() === JSON_ERROR_NONE) ? true :false; if ($isJson) { $filter = new Filter($filter); return $this->_getObjectsByFilter($filter); } else { return $this->_getObject($filter); } } else if (is_object($filter) && $filter instanceof Filter) { return $this->_getObjectsByFilter($filter); } return []; }
[ "public", "function", "find", "(", "$", "filter", "=", "null", ")", "{", "if", "(", "is_string", "(", "$", "filter", ")", ")", "{", "json_decode", "(", "$", "filter", ")", ";", "$", "isJson", "=", "(", "json_last_error", "(", ")", "===", "JSON_ERROR_...
Returns a collection of objects that match the filter criteria @param string|null|Fire\Sql\Filter $filter @return void
[ "Returns", "a", "collection", "of", "objects", "that", "match", "the", "filter", "criteria" ]
9c2a480ad16429e659ba9f476c27b73c9b5c9a06
https://github.com/ua1-labs/firesql/blob/9c2a480ad16429e659ba9f476c27b73c9b5c9a06/Fire/Sql/Collection.php#L86-L101
train