@@ -10,14 +10,14 @@ |
||
| 10 | 10 | class Emojis extends AbstractMiscellaneous |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * Lists all the emojis available to use on GitHub. |
|
| 15 | - * |
|
| 16 | - * @link https://developer.github.com/v3/emojis/#emojis |
|
| 17 | - * @return array |
|
| 18 | - */ |
|
| 19 | - public function get(): array |
|
| 20 | - { |
|
| 21 | - return $this->getApi()->request('/emojis'); |
|
| 22 | - } |
|
| 13 | + /** |
|
| 14 | + * Lists all the emojis available to use on GitHub. |
|
| 15 | + * |
|
| 16 | + * @link https://developer.github.com/v3/emojis/#emojis |
|
| 17 | + * @return array |
|
| 18 | + */ |
|
| 19 | + public function get(): array |
|
| 20 | + { |
|
| 21 | + return $this->getApi()->request('/emojis'); |
|
| 22 | + } |
|
| 23 | 23 | } |
| 24 | 24 | \ No newline at end of file |
@@ -10,28 +10,28 @@ |
||
| 10 | 10 | class Gitignore extends AbstractMiscellaneous |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * Listing available templates |
|
| 15 | - * |
|
| 16 | - * @link https://developer.github.com/v3/gitignore/#listing-available-templates |
|
| 17 | - * @return array |
|
| 18 | - */ |
|
| 19 | - public function listingAvailableTemplates(): array |
|
| 20 | - { |
|
| 21 | - return $this->getApi()->request('/gitignore/templates'); |
|
| 22 | - } |
|
| 13 | + /** |
|
| 14 | + * Listing available templates |
|
| 15 | + * |
|
| 16 | + * @link https://developer.github.com/v3/gitignore/#listing-available-templates |
|
| 17 | + * @return array |
|
| 18 | + */ |
|
| 19 | + public function listingAvailableTemplates(): array |
|
| 20 | + { |
|
| 21 | + return $this->getApi()->request('/gitignore/templates'); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Get a single template |
|
| 26 | - * |
|
| 27 | - * @link https://developer.github.com/v3/gitignore/#get-a-single-template |
|
| 28 | - * |
|
| 29 | - * @param string $name |
|
| 30 | - * |
|
| 31 | - * @return array |
|
| 32 | - */ |
|
| 33 | - public function getSingleTemplate(string $name): array |
|
| 34 | - { |
|
| 35 | - return $this->getApi()->request($this->getApi()->sprintf('/gitignore/templates/:name', $name)); |
|
| 36 | - } |
|
| 24 | + /** |
|
| 25 | + * Get a single template |
|
| 26 | + * |
|
| 27 | + * @link https://developer.github.com/v3/gitignore/#get-a-single-template |
|
| 28 | + * |
|
| 29 | + * @param string $name |
|
| 30 | + * |
|
| 31 | + * @return array |
|
| 32 | + */ |
|
| 33 | + public function getSingleTemplate(string $name): array |
|
| 34 | + { |
|
| 35 | + return $this->getApi()->request($this->getApi()->sprintf('/gitignore/templates/:name', $name)); |
|
| 36 | + } |
|
| 37 | 37 | } |
| 38 | 38 | \ No newline at end of file |
@@ -11,14 +11,14 @@ |
||
| 11 | 11 | class Meta extends AbstractMiscellaneous |
| 12 | 12 | { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Meta, provides information about GitHub.com, the service. |
|
| 16 | - * |
|
| 17 | - * @link https://developer.github.com/v3/meta/#meta |
|
| 18 | - * @return array |
|
| 19 | - */ |
|
| 20 | - public function get(): array |
|
| 21 | - { |
|
| 22 | - return $this->getApi()->request('/meta'); |
|
| 23 | - } |
|
| 14 | + /** |
|
| 15 | + * Meta, provides information about GitHub.com, the service. |
|
| 16 | + * |
|
| 17 | + * @link https://developer.github.com/v3/meta/#meta |
|
| 18 | + * @return array |
|
| 19 | + */ |
|
| 20 | + public function get(): array |
|
| 21 | + { |
|
| 22 | + return $this->getApi()->request('/meta'); |
|
| 23 | + } |
|
| 24 | 24 | } |
| 25 | 25 | \ No newline at end of file |
@@ -10,14 +10,14 @@ |
||
| 10 | 10 | class RateLimit extends AbstractMiscellaneous |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * Check your current rate limit status at any time using the Rate Limit API described below. |
|
| 15 | - * |
|
| 16 | - * @link https://developer.github.com/v3/rate_limit/#rate-limit |
|
| 17 | - * @return array |
|
| 18 | - */ |
|
| 19 | - public function get(): array |
|
| 20 | - { |
|
| 21 | - return $this->getApi()->request('/rate_limit'); |
|
| 22 | - } |
|
| 13 | + /** |
|
| 14 | + * Check your current rate limit status at any time using the Rate Limit API described below. |
|
| 15 | + * |
|
| 16 | + * @link https://developer.github.com/v3/rate_limit/#rate-limit |
|
| 17 | + * @return array |
|
| 18 | + */ |
|
| 19 | + public function get(): array |
|
| 20 | + { |
|
| 21 | + return $this->getApi()->request('/rate_limit'); |
|
| 22 | + } |
|
| 23 | 23 | } |
| 24 | 24 | \ No newline at end of file |
@@ -13,30 +13,30 @@ |
||
| 13 | 13 | class Licenses extends AbstractMiscellaneous |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * List all licenses |
|
| 18 | - * |
|
| 19 | - * @link https://developer.github.com/v3/licenses/#list-all-licenses |
|
| 20 | - * @return array |
|
| 21 | - */ |
|
| 22 | - public function listAllLicenses(): array |
|
| 23 | - { |
|
| 24 | - return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request('/licenses'); |
|
| 25 | - } |
|
| 16 | + /** |
|
| 17 | + * List all licenses |
|
| 18 | + * |
|
| 19 | + * @link https://developer.github.com/v3/licenses/#list-all-licenses |
|
| 20 | + * @return array |
|
| 21 | + */ |
|
| 22 | + public function listAllLicenses(): array |
|
| 23 | + { |
|
| 24 | + return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request('/licenses'); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Get an individual license |
|
| 29 | - * |
|
| 30 | - * @link https://developer.github.com/v3/licenses/#get-an-individual-license |
|
| 31 | - * |
|
| 32 | - * @param string $license |
|
| 33 | - * |
|
| 34 | - * @return array |
|
| 35 | - */ |
|
| 36 | - public function getIndividualLicense(string $license): array |
|
| 37 | - { |
|
| 38 | - return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request($this->getApi() |
|
| 39 | - ->sprintf('/licenses/:license', |
|
| 40 | - $license)); |
|
| 41 | - } |
|
| 27 | + /** |
|
| 28 | + * Get an individual license |
|
| 29 | + * |
|
| 30 | + * @link https://developer.github.com/v3/licenses/#get-an-individual-license |
|
| 31 | + * |
|
| 32 | + * @param string $license |
|
| 33 | + * |
|
| 34 | + * @return array |
|
| 35 | + */ |
|
| 36 | + public function getIndividualLicense(string $license): array |
|
| 37 | + { |
|
| 38 | + return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request($this->getApi() |
|
| 39 | + ->sprintf('/licenses/:license', |
|
| 40 | + $license)); |
|
| 41 | + } |
|
| 42 | 42 | } |
| 43 | 43 | \ No newline at end of file |
@@ -12,66 +12,66 @@ |
||
| 12 | 12 | abstract class AbstractMiscellaneous |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** Properties */ |
|
| 16 | - protected $miscellaneous; |
|
| 17 | - protected $api; |
|
| 15 | + /** Properties */ |
|
| 16 | + protected $miscellaneous; |
|
| 17 | + protected $api; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Constructor |
|
| 21 | - * |
|
| 22 | - * @param Miscellaneous $miscellaneous |
|
| 23 | - */ |
|
| 24 | - public function __construct(Miscellaneous $miscellaneous) |
|
| 25 | - { |
|
| 26 | - $this->setMiscellaneous($miscellaneous); |
|
| 27 | - $this->setApi($miscellaneous->getApi()); |
|
| 28 | - } |
|
| 19 | + /** |
|
| 20 | + * Constructor |
|
| 21 | + * |
|
| 22 | + * @param Miscellaneous $miscellaneous |
|
| 23 | + */ |
|
| 24 | + public function __construct(Miscellaneous $miscellaneous) |
|
| 25 | + { |
|
| 26 | + $this->setMiscellaneous($miscellaneous); |
|
| 27 | + $this->setApi($miscellaneous->getApi()); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Get miscellaneous |
|
| 32 | - * |
|
| 33 | - * @return Miscellaneous |
|
| 34 | - */ |
|
| 35 | - public function getMiscellaneous(): Miscellaneous |
|
| 36 | - { |
|
| 37 | - return $this->miscellaneous; |
|
| 38 | - } |
|
| 30 | + /** |
|
| 31 | + * Get miscellaneous |
|
| 32 | + * |
|
| 33 | + * @return Miscellaneous |
|
| 34 | + */ |
|
| 35 | + public function getMiscellaneous(): Miscellaneous |
|
| 36 | + { |
|
| 37 | + return $this->miscellaneous; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Set miscellaneous |
|
| 42 | - * |
|
| 43 | - * @param Miscellaneous $miscellaneous |
|
| 44 | - * |
|
| 45 | - * @return AbstractMiscellaneous |
|
| 46 | - */ |
|
| 47 | - public function setMiscellaneous(Miscellaneous $miscellaneous): AbstractMiscellaneous |
|
| 48 | - { |
|
| 49 | - $this->miscellaneous = $miscellaneous; |
|
| 40 | + /** |
|
| 41 | + * Set miscellaneous |
|
| 42 | + * |
|
| 43 | + * @param Miscellaneous $miscellaneous |
|
| 44 | + * |
|
| 45 | + * @return AbstractMiscellaneous |
|
| 46 | + */ |
|
| 47 | + public function setMiscellaneous(Miscellaneous $miscellaneous): AbstractMiscellaneous |
|
| 48 | + { |
|
| 49 | + $this->miscellaneous = $miscellaneous; |
|
| 50 | 50 | |
| 51 | - return $this; |
|
| 52 | - } |
|
| 51 | + return $this; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Get api |
|
| 56 | - * |
|
| 57 | - * @return AbstractApi |
|
| 58 | - */ |
|
| 59 | - public function getApi(): AbstractApi |
|
| 60 | - { |
|
| 61 | - return $this->api; |
|
| 62 | - } |
|
| 54 | + /** |
|
| 55 | + * Get api |
|
| 56 | + * |
|
| 57 | + * @return AbstractApi |
|
| 58 | + */ |
|
| 59 | + public function getApi(): AbstractApi |
|
| 60 | + { |
|
| 61 | + return $this->api; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Set api |
|
| 66 | - * |
|
| 67 | - * @param AbstractApi $api |
|
| 68 | - * |
|
| 69 | - * @return AbstractMiscellaneous |
|
| 70 | - */ |
|
| 71 | - public function setApi(AbstractApi $api): AbstractMiscellaneous |
|
| 72 | - { |
|
| 73 | - $this->api = $api; |
|
| 64 | + /** |
|
| 65 | + * Set api |
|
| 66 | + * |
|
| 67 | + * @param AbstractApi $api |
|
| 68 | + * |
|
| 69 | + * @return AbstractMiscellaneous |
|
| 70 | + */ |
|
| 71 | + public function setApi(AbstractApi $api): AbstractMiscellaneous |
|
| 72 | + { |
|
| 73 | + $this->api = $api; |
|
| 74 | 74 | |
| 75 | - return $this; |
|
| 76 | - } |
|
| 75 | + return $this; |
|
| 76 | + } |
|
| 77 | 77 | } |
| 78 | 78 | \ No newline at end of file |
@@ -13,38 +13,38 @@ |
||
| 13 | 13 | class Markdown extends AbstractMiscellaneous |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Render an arbitrary Markdown document |
|
| 18 | - * |
|
| 19 | - * @link https://developer.github.com/v3/markdown/#render-an-arbitrary-markdown-document |
|
| 20 | - * |
|
| 21 | - * @param string $text The Markdown text to render |
|
| 22 | - * @param string $mode The rendering mode. |
|
| 23 | - * @param string $context The repository context. Only taken into account when rendering as gfm |
|
| 24 | - * |
|
| 25 | - * @return array |
|
| 26 | - */ |
|
| 27 | - public function render(string $text, string $mode = AbstractApi::MODE_MARKDOWN, string $context = ''): array |
|
| 28 | - { |
|
| 29 | - return $this->getApi()->request('/markdown', Request::METHOD_POST, [ |
|
| 30 | - 'text' => $text, |
|
| 31 | - 'mode' => $mode, |
|
| 32 | - 'context' => $context |
|
| 33 | - ]); |
|
| 34 | - } |
|
| 16 | + /** |
|
| 17 | + * Render an arbitrary Markdown document |
|
| 18 | + * |
|
| 19 | + * @link https://developer.github.com/v3/markdown/#render-an-arbitrary-markdown-document |
|
| 20 | + * |
|
| 21 | + * @param string $text The Markdown text to render |
|
| 22 | + * @param string $mode The rendering mode. |
|
| 23 | + * @param string $context The repository context. Only taken into account when rendering as gfm |
|
| 24 | + * |
|
| 25 | + * @return array |
|
| 26 | + */ |
|
| 27 | + public function render(string $text, string $mode = AbstractApi::MODE_MARKDOWN, string $context = ''): array |
|
| 28 | + { |
|
| 29 | + return $this->getApi()->request('/markdown', Request::METHOD_POST, [ |
|
| 30 | + 'text' => $text, |
|
| 31 | + 'mode' => $mode, |
|
| 32 | + 'context' => $context |
|
| 33 | + ]); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Render a Markdown document in raw mode |
|
| 38 | - * |
|
| 39 | - * @link https://developer.github.com/v3/markdown/#render-a-markdown-document-in-raw-mode |
|
| 40 | - * |
|
| 41 | - * @param string $file |
|
| 42 | - * |
|
| 43 | - * @return array |
|
| 44 | - */ |
|
| 45 | - public function renderRaw(string $file): array |
|
| 46 | - { |
|
| 47 | - return $this->getApi()->setAccept('text/plain') |
|
| 48 | - ->request('/markdown/raw', Request::METHOD_POST, ['file' => $file]); |
|
| 49 | - } |
|
| 36 | + /** |
|
| 37 | + * Render a Markdown document in raw mode |
|
| 38 | + * |
|
| 39 | + * @link https://developer.github.com/v3/markdown/#render-a-markdown-document-in-raw-mode |
|
| 40 | + * |
|
| 41 | + * @param string $file |
|
| 42 | + * |
|
| 43 | + * @return array |
|
| 44 | + */ |
|
| 45 | + public function renderRaw(string $file): array |
|
| 46 | + { |
|
| 47 | + return $this->getApi()->setAccept('text/plain') |
|
| 48 | + ->request('/markdown/raw', Request::METHOD_POST, ['file' => $file]); |
|
| 49 | + } |
|
| 50 | 50 | } |
| 51 | 51 | \ No newline at end of file |
@@ -11,137 +11,137 @@ |
||
| 11 | 11 | class Events extends AbstractActivity |
| 12 | 12 | { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * List public events |
|
| 16 | - * |
|
| 17 | - * @link https://developer.github.com/v3/activity/events/#list-public-events |
|
| 18 | - * @return array |
|
| 19 | - */ |
|
| 20 | - public function listPublicEvents(): array |
|
| 21 | - { |
|
| 22 | - return $this->getApi()->request(sprintf('/events')); |
|
| 23 | - } |
|
| 14 | + /** |
|
| 15 | + * List public events |
|
| 16 | + * |
|
| 17 | + * @link https://developer.github.com/v3/activity/events/#list-public-events |
|
| 18 | + * @return array |
|
| 19 | + */ |
|
| 20 | + public function listPublicEvents(): array |
|
| 21 | + { |
|
| 22 | + return $this->getApi()->request(sprintf('/events')); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * List repository events |
|
| 27 | - * |
|
| 28 | - * @link https://developer.github.com/v3/activity/events/#list-repository-events |
|
| 29 | - * @return array |
|
| 30 | - */ |
|
| 31 | - public function listRepositoryEvents(): array |
|
| 32 | - { |
|
| 33 | - return $this->getApi()->request($this->getApi() |
|
| 34 | - ->sprintf('/repos/:owner/:repo/events', $this->getActivity()->getOwner(), |
|
| 35 | - $this->getActivity()->getRepo())); |
|
| 36 | - } |
|
| 25 | + /** |
|
| 26 | + * List repository events |
|
| 27 | + * |
|
| 28 | + * @link https://developer.github.com/v3/activity/events/#list-repository-events |
|
| 29 | + * @return array |
|
| 30 | + */ |
|
| 31 | + public function listRepositoryEvents(): array |
|
| 32 | + { |
|
| 33 | + return $this->getApi()->request($this->getApi() |
|
| 34 | + ->sprintf('/repos/:owner/:repo/events', $this->getActivity()->getOwner(), |
|
| 35 | + $this->getActivity()->getRepo())); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * List issue events for a repository |
|
| 40 | - * |
|
| 41 | - * @link https://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository |
|
| 42 | - * @return array |
|
| 43 | - */ |
|
| 44 | - public function listIssueEvents(): array |
|
| 45 | - { |
|
| 46 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events', |
|
| 47 | - $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
| 48 | - } |
|
| 38 | + /** |
|
| 39 | + * List issue events for a repository |
|
| 40 | + * |
|
| 41 | + * @link https://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository |
|
| 42 | + * @return array |
|
| 43 | + */ |
|
| 44 | + public function listIssueEvents(): array |
|
| 45 | + { |
|
| 46 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events', |
|
| 47 | + $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * List public events for a network of repositories |
|
| 52 | - * |
|
| 53 | - * @link https://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories |
|
| 54 | - * @return array |
|
| 55 | - */ |
|
| 56 | - public function listPublicNetworkEvents(): array |
|
| 57 | - { |
|
| 58 | - return $this->getApi()->request($this->getApi()->sprintf('/networks/:owner/:repo/events', |
|
| 59 | - $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
| 60 | - } |
|
| 50 | + /** |
|
| 51 | + * List public events for a network of repositories |
|
| 52 | + * |
|
| 53 | + * @link https://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories |
|
| 54 | + * @return array |
|
| 55 | + */ |
|
| 56 | + public function listPublicNetworkEvents(): array |
|
| 57 | + { |
|
| 58 | + return $this->getApi()->request($this->getApi()->sprintf('/networks/:owner/:repo/events', |
|
| 59 | + $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * List public events for an organization |
|
| 64 | - * |
|
| 65 | - * @link https://developer.github.com/v3/activity/events/#list-public-events-for-an-organization |
|
| 66 | - * |
|
| 67 | - * @param string $organization |
|
| 68 | - * |
|
| 69 | - * @return array |
|
| 70 | - */ |
|
| 71 | - public function listPublicOrganizationEvents(string $organization): array |
|
| 72 | - { |
|
| 73 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/events', $organization)); |
|
| 74 | - } |
|
| 62 | + /** |
|
| 63 | + * List public events for an organization |
|
| 64 | + * |
|
| 65 | + * @link https://developer.github.com/v3/activity/events/#list-public-events-for-an-organization |
|
| 66 | + * |
|
| 67 | + * @param string $organization |
|
| 68 | + * |
|
| 69 | + * @return array |
|
| 70 | + */ |
|
| 71 | + public function listPublicOrganizationEvents(string $organization): array |
|
| 72 | + { |
|
| 73 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/events', $organization)); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * List events that a user has received |
|
| 78 | - * |
|
| 79 | - * @link https://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received |
|
| 80 | - * |
|
| 81 | - * @param string $username |
|
| 82 | - * |
|
| 83 | - * @return array |
|
| 84 | - */ |
|
| 85 | - public function listUserReceiveEvents(string $username): array |
|
| 86 | - { |
|
| 87 | - return $this->getApi()->request($this->getApi()->sprintf('/users/:username/received_events', $username)); |
|
| 88 | - } |
|
| 76 | + /** |
|
| 77 | + * List events that a user has received |
|
| 78 | + * |
|
| 79 | + * @link https://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received |
|
| 80 | + * |
|
| 81 | + * @param string $username |
|
| 82 | + * |
|
| 83 | + * @return array |
|
| 84 | + */ |
|
| 85 | + public function listUserReceiveEvents(string $username): array |
|
| 86 | + { |
|
| 87 | + return $this->getApi()->request($this->getApi()->sprintf('/users/:username/received_events', $username)); |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * List public events that a user has received |
|
| 92 | - * |
|
| 93 | - * @link https://developer.github.com/v3/activity/events/#list-public-events-that-a-user-has-received |
|
| 94 | - * |
|
| 95 | - * @param string $username |
|
| 96 | - * |
|
| 97 | - * @return array |
|
| 98 | - */ |
|
| 99 | - public function listPublicUserReceiveEvents(string $username): array |
|
| 100 | - { |
|
| 101 | - return $this->getApi()->request($this->getApi()->sprintf('/users/:username/received_events/public', $username)); |
|
| 102 | - } |
|
| 90 | + /** |
|
| 91 | + * List public events that a user has received |
|
| 92 | + * |
|
| 93 | + * @link https://developer.github.com/v3/activity/events/#list-public-events-that-a-user-has-received |
|
| 94 | + * |
|
| 95 | + * @param string $username |
|
| 96 | + * |
|
| 97 | + * @return array |
|
| 98 | + */ |
|
| 99 | + public function listPublicUserReceiveEvents(string $username): array |
|
| 100 | + { |
|
| 101 | + return $this->getApi()->request($this->getApi()->sprintf('/users/:username/received_events/public', $username)); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * List events performed by a user |
|
| 106 | - * |
|
| 107 | - * @link https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user |
|
| 108 | - * |
|
| 109 | - * @param string $username |
|
| 110 | - * |
|
| 111 | - * @return array |
|
| 112 | - */ |
|
| 113 | - public function listUserPerformedEvents(string $username): array |
|
| 114 | - { |
|
| 115 | - return $this->getApi()->request($this->getApi()->sprintf('/users/:username/events', $username)); |
|
| 116 | - } |
|
| 104 | + /** |
|
| 105 | + * List events performed by a user |
|
| 106 | + * |
|
| 107 | + * @link https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user |
|
| 108 | + * |
|
| 109 | + * @param string $username |
|
| 110 | + * |
|
| 111 | + * @return array |
|
| 112 | + */ |
|
| 113 | + public function listUserPerformedEvents(string $username): array |
|
| 114 | + { |
|
| 115 | + return $this->getApi()->request($this->getApi()->sprintf('/users/:username/events', $username)); |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - /** |
|
| 119 | - * List public events performed by a user |
|
| 120 | - * |
|
| 121 | - * @link https://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user |
|
| 122 | - * |
|
| 123 | - * @param string $username |
|
| 124 | - * |
|
| 125 | - * @return array |
|
| 126 | - */ |
|
| 127 | - public function listPublicUserPerformedEvents(string $username): array |
|
| 128 | - { |
|
| 129 | - return $this->getApi()->request($this->getApi()->sprintf('/users/:username/events/public', $username)); |
|
| 130 | - } |
|
| 118 | + /** |
|
| 119 | + * List public events performed by a user |
|
| 120 | + * |
|
| 121 | + * @link https://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user |
|
| 122 | + * |
|
| 123 | + * @param string $username |
|
| 124 | + * |
|
| 125 | + * @return array |
|
| 126 | + */ |
|
| 127 | + public function listPublicUserPerformedEvents(string $username): array |
|
| 128 | + { |
|
| 129 | + return $this->getApi()->request($this->getApi()->sprintf('/users/:username/events/public', $username)); |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | - /** |
|
| 133 | - * List events for an organization |
|
| 134 | - * |
|
| 135 | - * @link https://developer.github.com/v3/activity/events/#list-events-for-an-organization |
|
| 136 | - * |
|
| 137 | - * @param string $username |
|
| 138 | - * @param string $organization |
|
| 139 | - * |
|
| 140 | - * @return array |
|
| 141 | - */ |
|
| 142 | - public function listOrganizationEvents(string $username, string $organization): array |
|
| 143 | - { |
|
| 144 | - return $this->getApi()->request($this->getApi() |
|
| 145 | - ->sprintf('/users/:username/events/orgs/:org', $username, $organization)); |
|
| 146 | - } |
|
| 132 | + /** |
|
| 133 | + * List events for an organization |
|
| 134 | + * |
|
| 135 | + * @link https://developer.github.com/v3/activity/events/#list-events-for-an-organization |
|
| 136 | + * |
|
| 137 | + * @param string $username |
|
| 138 | + * @param string $organization |
|
| 139 | + * |
|
| 140 | + * @return array |
|
| 141 | + */ |
|
| 142 | + public function listOrganizationEvents(string $username, string $organization): array |
|
| 143 | + { |
|
| 144 | + return $this->getApi()->request($this->getApi() |
|
| 145 | + ->sprintf('/users/:username/events/orgs/:org', $username, $organization)); |
|
| 146 | + } |
|
| 147 | 147 | } |
| 148 | 148 | \ No newline at end of file |
@@ -14,167 +14,167 @@ |
||
| 14 | 14 | class Notifications extends AbstractActivity |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * List your notifications |
|
| 19 | - * |
|
| 20 | - * @link https://developer.github.com/v3/activity/notifications/#list-your-notifications |
|
| 21 | - * |
|
| 22 | - * @param bool $all |
|
| 23 | - * @param bool $participating |
|
| 24 | - * @param string $since |
|
| 25 | - * @param string $before |
|
| 26 | - * |
|
| 27 | - * @return array |
|
| 28 | - * @throws \Exception |
|
| 29 | - */ |
|
| 30 | - public function listNotifications(bool $all = false, bool $participating = false, string $since = 'now', |
|
| 31 | - string $before = null): array |
|
| 32 | - { |
|
| 33 | - return $this->getApi()->request($this->getApi()->sprintf('/notifications?:args', http_build_query([ |
|
| 34 | - 'all' => $all, |
|
| 35 | - 'participating' => $participating, |
|
| 36 | - 'since' => (new DateTime($since))->format(DateTime::ATOM), |
|
| 37 | - 'before' => (new DateTime($before))->format(DateTime::ATOM) |
|
| 38 | - ]))); |
|
| 39 | - } |
|
| 17 | + /** |
|
| 18 | + * List your notifications |
|
| 19 | + * |
|
| 20 | + * @link https://developer.github.com/v3/activity/notifications/#list-your-notifications |
|
| 21 | + * |
|
| 22 | + * @param bool $all |
|
| 23 | + * @param bool $participating |
|
| 24 | + * @param string $since |
|
| 25 | + * @param string $before |
|
| 26 | + * |
|
| 27 | + * @return array |
|
| 28 | + * @throws \Exception |
|
| 29 | + */ |
|
| 30 | + public function listNotifications(bool $all = false, bool $participating = false, string $since = 'now', |
|
| 31 | + string $before = null): array |
|
| 32 | + { |
|
| 33 | + return $this->getApi()->request($this->getApi()->sprintf('/notifications?:args', http_build_query([ |
|
| 34 | + 'all' => $all, |
|
| 35 | + 'participating' => $participating, |
|
| 36 | + 'since' => (new DateTime($since))->format(DateTime::ATOM), |
|
| 37 | + 'before' => (new DateTime($before))->format(DateTime::ATOM) |
|
| 38 | + ]))); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * List your notifications in a repository |
|
| 43 | - * |
|
| 44 | - * @link https://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository |
|
| 45 | - * |
|
| 46 | - * @param bool $all |
|
| 47 | - * @param bool $participating |
|
| 48 | - * @param string $since |
|
| 49 | - * @param string $before |
|
| 50 | - * |
|
| 51 | - * @return array |
|
| 52 | - * @throws \Exception |
|
| 53 | - */ |
|
| 54 | - public function listRepositoryNotifications(bool $all = false, bool $participating = false, string $since = 'now', |
|
| 55 | - string $before = null): array |
|
| 56 | - { |
|
| 57 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/notifications?:args', |
|
| 58 | - $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), http_build_query([ |
|
| 59 | - 'all' => $all, |
|
| 60 | - 'participating' => $participating, |
|
| 61 | - 'since' => (new DateTime($since))->format(DateTime::ATOM), |
|
| 62 | - 'before' => (new DateTime($before))->format(DateTime::ATOM) |
|
| 63 | - ]))); |
|
| 64 | - } |
|
| 41 | + /** |
|
| 42 | + * List your notifications in a repository |
|
| 43 | + * |
|
| 44 | + * @link https://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository |
|
| 45 | + * |
|
| 46 | + * @param bool $all |
|
| 47 | + * @param bool $participating |
|
| 48 | + * @param string $since |
|
| 49 | + * @param string $before |
|
| 50 | + * |
|
| 51 | + * @return array |
|
| 52 | + * @throws \Exception |
|
| 53 | + */ |
|
| 54 | + public function listRepositoryNotifications(bool $all = false, bool $participating = false, string $since = 'now', |
|
| 55 | + string $before = null): array |
|
| 56 | + { |
|
| 57 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/notifications?:args', |
|
| 58 | + $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), http_build_query([ |
|
| 59 | + 'all' => $all, |
|
| 60 | + 'participating' => $participating, |
|
| 61 | + 'since' => (new DateTime($since))->format(DateTime::ATOM), |
|
| 62 | + 'before' => (new DateTime($before))->format(DateTime::ATOM) |
|
| 63 | + ]))); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Mark as read |
|
| 68 | - * |
|
| 69 | - * @link https://developer.github.com/v3/activity/notifications/#mark-as-read |
|
| 70 | - * |
|
| 71 | - * @param string $lastReadAt |
|
| 72 | - * |
|
| 73 | - * @return array |
|
| 74 | - */ |
|
| 75 | - public function markAsRead(string $lastReadAt = 'now'): array |
|
| 76 | - { |
|
| 77 | - return $this->getApi()->request($this->getApi()->sprintf('/notifications?:args', |
|
| 78 | - http_build_query(['last_read_at' => (new DateTime($lastReadAt))->format(DateTime::ATOM)])), |
|
| 79 | - Request::METHOD_PUT); |
|
| 80 | - } |
|
| 66 | + /** |
|
| 67 | + * Mark as read |
|
| 68 | + * |
|
| 69 | + * @link https://developer.github.com/v3/activity/notifications/#mark-as-read |
|
| 70 | + * |
|
| 71 | + * @param string $lastReadAt |
|
| 72 | + * |
|
| 73 | + * @return array |
|
| 74 | + */ |
|
| 75 | + public function markAsRead(string $lastReadAt = 'now'): array |
|
| 76 | + { |
|
| 77 | + return $this->getApi()->request($this->getApi()->sprintf('/notifications?:args', |
|
| 78 | + http_build_query(['last_read_at' => (new DateTime($lastReadAt))->format(DateTime::ATOM)])), |
|
| 79 | + Request::METHOD_PUT); |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Mark notifications as read in a repository |
|
| 84 | - * |
|
| 85 | - * @link https://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository |
|
| 86 | - * |
|
| 87 | - * @param string $lastReadAt |
|
| 88 | - * |
|
| 89 | - * @return array |
|
| 90 | - */ |
|
| 91 | - public function markAsReadInRepository(string $lastReadAt = 'now'): array |
|
| 92 | - { |
|
| 93 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/notifications?:args', |
|
| 94 | - $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), |
|
| 95 | - http_build_query(['last_read_at' => (new DateTime($lastReadAt))->format(DateTime::ATOM)])), |
|
| 96 | - Request::METHOD_PUT); |
|
| 97 | - } |
|
| 82 | + /** |
|
| 83 | + * Mark notifications as read in a repository |
|
| 84 | + * |
|
| 85 | + * @link https://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository |
|
| 86 | + * |
|
| 87 | + * @param string $lastReadAt |
|
| 88 | + * |
|
| 89 | + * @return array |
|
| 90 | + */ |
|
| 91 | + public function markAsReadInRepository(string $lastReadAt = 'now'): array |
|
| 92 | + { |
|
| 93 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/notifications?:args', |
|
| 94 | + $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), |
|
| 95 | + http_build_query(['last_read_at' => (new DateTime($lastReadAt))->format(DateTime::ATOM)])), |
|
| 96 | + Request::METHOD_PUT); |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - /** |
|
| 100 | - *View a single thread |
|
| 101 | - * |
|
| 102 | - * @link https://developer.github.com/v3/activity/notifications/#view-a-single-thread |
|
| 103 | - * |
|
| 104 | - * @param int $id |
|
| 105 | - * |
|
| 106 | - * @return array |
|
| 107 | - */ |
|
| 108 | - public function viewThread(int $id): array |
|
| 109 | - { |
|
| 110 | - return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id', (string)$id)); |
|
| 111 | - } |
|
| 99 | + /** |
|
| 100 | + *View a single thread |
|
| 101 | + * |
|
| 102 | + * @link https://developer.github.com/v3/activity/notifications/#view-a-single-thread |
|
| 103 | + * |
|
| 104 | + * @param int $id |
|
| 105 | + * |
|
| 106 | + * @return array |
|
| 107 | + */ |
|
| 108 | + public function viewThread(int $id): array |
|
| 109 | + { |
|
| 110 | + return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id', (string)$id)); |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | - /** |
|
| 114 | - * Mark a thread as read |
|
| 115 | - * |
|
| 116 | - * @link https://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read |
|
| 117 | - * |
|
| 118 | - * @param int $id |
|
| 119 | - * |
|
| 120 | - * @return array |
|
| 121 | - */ |
|
| 122 | - public function markThreadAsRead(int $id): array |
|
| 123 | - { |
|
| 124 | - return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id', (string)$id), |
|
| 125 | - Request::METHOD_PATCH); |
|
| 126 | - } |
|
| 113 | + /** |
|
| 114 | + * Mark a thread as read |
|
| 115 | + * |
|
| 116 | + * @link https://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read |
|
| 117 | + * |
|
| 118 | + * @param int $id |
|
| 119 | + * |
|
| 120 | + * @return array |
|
| 121 | + */ |
|
| 122 | + public function markThreadAsRead(int $id): array |
|
| 123 | + { |
|
| 124 | + return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id', (string)$id), |
|
| 125 | + Request::METHOD_PATCH); |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - /** |
|
| 129 | - * Get a Thread Subscription |
|
| 130 | - * |
|
| 131 | - * @link https://developer.github.com/v3/activity/notifications/#get-a-thread-subscription |
|
| 132 | - * |
|
| 133 | - * @param int $id |
|
| 134 | - * |
|
| 135 | - * @return array |
|
| 136 | - */ |
|
| 137 | - public function getThreadSubscription(int $id): array |
|
| 138 | - { |
|
| 139 | - return $this->getApi()->request($this->getApi() |
|
| 140 | - ->sprintf('/notifications/threads/:id/subscription', (string)$id)); |
|
| 141 | - } |
|
| 128 | + /** |
|
| 129 | + * Get a Thread Subscription |
|
| 130 | + * |
|
| 131 | + * @link https://developer.github.com/v3/activity/notifications/#get-a-thread-subscription |
|
| 132 | + * |
|
| 133 | + * @param int $id |
|
| 134 | + * |
|
| 135 | + * @return array |
|
| 136 | + */ |
|
| 137 | + public function getThreadSubscription(int $id): array |
|
| 138 | + { |
|
| 139 | + return $this->getApi()->request($this->getApi() |
|
| 140 | + ->sprintf('/notifications/threads/:id/subscription', (string)$id)); |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | - /** |
|
| 144 | - * Set a Thread Subscription |
|
| 145 | - * |
|
| 146 | - * @link https://developer.github.com/v3/activity/notifications/#set-a-thread-subscription |
|
| 147 | - * |
|
| 148 | - * @param int $id |
|
| 149 | - * @param bool $subscribed |
|
| 150 | - * @param bool $ignored |
|
| 151 | - * |
|
| 152 | - * @return array |
|
| 153 | - */ |
|
| 154 | - public function setThreadSubscription(int $id, bool $subscribed = false, bool $ignored = false): array |
|
| 155 | - { |
|
| 156 | - return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id/subscription?:args', $id, |
|
| 157 | - http_build_query(['subscribed' => $subscribed, 'ignored' => $ignored])), Request::METHOD_PUT); |
|
| 158 | - } |
|
| 143 | + /** |
|
| 144 | + * Set a Thread Subscription |
|
| 145 | + * |
|
| 146 | + * @link https://developer.github.com/v3/activity/notifications/#set-a-thread-subscription |
|
| 147 | + * |
|
| 148 | + * @param int $id |
|
| 149 | + * @param bool $subscribed |
|
| 150 | + * @param bool $ignored |
|
| 151 | + * |
|
| 152 | + * @return array |
|
| 153 | + */ |
|
| 154 | + public function setThreadSubscription(int $id, bool $subscribed = false, bool $ignored = false): array |
|
| 155 | + { |
|
| 156 | + return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id/subscription?:args', $id, |
|
| 157 | + http_build_query(['subscribed' => $subscribed, 'ignored' => $ignored])), Request::METHOD_PUT); |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | - /** |
|
| 161 | - * Delete a Thread Subscription |
|
| 162 | - * |
|
| 163 | - * @link https://developer.github.com/v3/activity/notifications/#delete-a-thread-subscription |
|
| 164 | - * |
|
| 165 | - * @param int $id |
|
| 166 | - * |
|
| 167 | - * @return bool |
|
| 168 | - */ |
|
| 169 | - public function deleteThreadSubscription(int $id): bool |
|
| 170 | - { |
|
| 171 | - $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id/subscription', (string)$id), |
|
| 172 | - Request::METHOD_DELETE); |
|
| 160 | + /** |
|
| 161 | + * Delete a Thread Subscription |
|
| 162 | + * |
|
| 163 | + * @link https://developer.github.com/v3/activity/notifications/#delete-a-thread-subscription |
|
| 164 | + * |
|
| 165 | + * @param int $id |
|
| 166 | + * |
|
| 167 | + * @return bool |
|
| 168 | + */ |
|
| 169 | + public function deleteThreadSubscription(int $id): bool |
|
| 170 | + { |
|
| 171 | + $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id/subscription', (string)$id), |
|
| 172 | + Request::METHOD_DELETE); |
|
| 173 | 173 | |
| 174 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 175 | - return true; |
|
| 176 | - } |
|
| 174 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 175 | + return true; |
|
| 176 | + } |
|
| 177 | 177 | |
| 178 | - return false; |
|
| 179 | - } |
|
| 178 | + return false; |
|
| 179 | + } |
|
| 180 | 180 | } |
| 181 | 181 | \ No newline at end of file |