@@ -12,98 +12,98 @@ |
||
| 12 | 12 | class References extends AbstractGitData |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Get a Reference |
|
| 17 | - * |
|
| 18 | - * @link https://developer.github.com/v3/git/refs/#get-a-reference |
|
| 19 | - * |
|
| 20 | - * @param string $branch |
|
| 21 | - * |
|
| 22 | - * @return array |
|
| 23 | - * @throws \Exception |
|
| 24 | - */ |
|
| 25 | - public function get(string $branch): array |
|
| 26 | - { |
|
| 27 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/refs/heads/:branch', |
|
| 28 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $branch)); |
|
| 29 | - } |
|
| 15 | + /** |
|
| 16 | + * Get a Reference |
|
| 17 | + * |
|
| 18 | + * @link https://developer.github.com/v3/git/refs/#get-a-reference |
|
| 19 | + * |
|
| 20 | + * @param string $branch |
|
| 21 | + * |
|
| 22 | + * @return array |
|
| 23 | + * @throws \Exception |
|
| 24 | + */ |
|
| 25 | + public function get(string $branch): array |
|
| 26 | + { |
|
| 27 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/refs/heads/:branch', |
|
| 28 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $branch)); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Get all References |
|
| 33 | - * |
|
| 34 | - * @link https://developer.github.com/v3/git/refs/#get-all-references |
|
| 35 | - * @return array |
|
| 36 | - * @throws \Exception |
|
| 37 | - */ |
|
| 38 | - public function getAll(): array |
|
| 39 | - { |
|
| 40 | - return $this->getApi()->request($this->getApi() |
|
| 41 | - ->sprintf('/repos/:owner/:repo/git/refs', $this->getGitData()->getOwner(), |
|
| 42 | - $this->getGitData()->getRepo())); |
|
| 43 | - } |
|
| 31 | + /** |
|
| 32 | + * Get all References |
|
| 33 | + * |
|
| 34 | + * @link https://developer.github.com/v3/git/refs/#get-all-references |
|
| 35 | + * @return array |
|
| 36 | + * @throws \Exception |
|
| 37 | + */ |
|
| 38 | + public function getAll(): array |
|
| 39 | + { |
|
| 40 | + return $this->getApi()->request($this->getApi() |
|
| 41 | + ->sprintf('/repos/:owner/:repo/git/refs', $this->getGitData()->getOwner(), |
|
| 42 | + $this->getGitData()->getRepo())); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Create a Reference |
|
| 47 | - * |
|
| 48 | - * @link https://developer.github.com/v3/git/refs/#create-a-reference |
|
| 49 | - * |
|
| 50 | - * @param string $ref |
|
| 51 | - * @param string $sha |
|
| 52 | - * |
|
| 53 | - * @return array |
|
| 54 | - * @throws \Exception |
|
| 55 | - */ |
|
| 56 | - public function create(string $ref, string $sha): array |
|
| 57 | - { |
|
| 58 | - return $this->getApi()->request($this->getApi() |
|
| 59 | - ->sprintf('/repos/:owner/:repo/git/refs', $this->getGitData()->getOwner(), |
|
| 60 | - $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
| 61 | - 'ref' => $ref, |
|
| 62 | - 'sha' => $sha |
|
| 63 | - ]); |
|
| 64 | - } |
|
| 45 | + /** |
|
| 46 | + * Create a Reference |
|
| 47 | + * |
|
| 48 | + * @link https://developer.github.com/v3/git/refs/#create-a-reference |
|
| 49 | + * |
|
| 50 | + * @param string $ref |
|
| 51 | + * @param string $sha |
|
| 52 | + * |
|
| 53 | + * @return array |
|
| 54 | + * @throws \Exception |
|
| 55 | + */ |
|
| 56 | + public function create(string $ref, string $sha): array |
|
| 57 | + { |
|
| 58 | + return $this->getApi()->request($this->getApi() |
|
| 59 | + ->sprintf('/repos/:owner/:repo/git/refs', $this->getGitData()->getOwner(), |
|
| 60 | + $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
| 61 | + 'ref' => $ref, |
|
| 62 | + 'sha' => $sha |
|
| 63 | + ]); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Update a Reference |
|
| 68 | - * |
|
| 69 | - * @link https://developer.github.com/v3/git/refs/#update-a-reference |
|
| 70 | - * |
|
| 71 | - * @param string $ref |
|
| 72 | - * @param string $sha |
|
| 73 | - * @param bool $force |
|
| 74 | - * |
|
| 75 | - * @return array |
|
| 76 | - * @throws \Exception |
|
| 77 | - */ |
|
| 78 | - public function update(string $ref, string $sha, bool $force = false): array |
|
| 79 | - { |
|
| 80 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/refs/:ref', |
|
| 81 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $ref), Request::METHOD_POST, [ |
|
| 82 | - 'sha' => $sha, |
|
| 83 | - 'force' => $force |
|
| 84 | - ]); |
|
| 85 | - } |
|
| 66 | + /** |
|
| 67 | + * Update a Reference |
|
| 68 | + * |
|
| 69 | + * @link https://developer.github.com/v3/git/refs/#update-a-reference |
|
| 70 | + * |
|
| 71 | + * @param string $ref |
|
| 72 | + * @param string $sha |
|
| 73 | + * @param bool $force |
|
| 74 | + * |
|
| 75 | + * @return array |
|
| 76 | + * @throws \Exception |
|
| 77 | + */ |
|
| 78 | + public function update(string $ref, string $sha, bool $force = false): array |
|
| 79 | + { |
|
| 80 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/refs/:ref', |
|
| 81 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $ref), Request::METHOD_POST, [ |
|
| 82 | + 'sha' => $sha, |
|
| 83 | + 'force' => $force |
|
| 84 | + ]); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * Delete a Reference |
|
| 89 | - * |
|
| 90 | - * @link https://developer.github.com/v3/git/refs/#delete-a-reference |
|
| 91 | - * |
|
| 92 | - * @param string $ref |
|
| 93 | - * |
|
| 94 | - * @return bool |
|
| 95 | - * @throws \Exception |
|
| 96 | - */ |
|
| 97 | - public function delete(string $ref): bool |
|
| 98 | - { |
|
| 99 | - $this->getApi()->request($this->getApi() |
|
| 100 | - ->sprintf('/repos/:owner/:repo/git/refs/:ref', $this->getGitData()->getOwner(), |
|
| 101 | - $this->getGitData()->getRepo(), $ref), Request::METHOD_DELETE); |
|
| 87 | + /** |
|
| 88 | + * Delete a Reference |
|
| 89 | + * |
|
| 90 | + * @link https://developer.github.com/v3/git/refs/#delete-a-reference |
|
| 91 | + * |
|
| 92 | + * @param string $ref |
|
| 93 | + * |
|
| 94 | + * @return bool |
|
| 95 | + * @throws \Exception |
|
| 96 | + */ |
|
| 97 | + public function delete(string $ref): bool |
|
| 98 | + { |
|
| 99 | + $this->getApi()->request($this->getApi() |
|
| 100 | + ->sprintf('/repos/:owner/:repo/git/refs/:ref', $this->getGitData()->getOwner(), |
|
| 101 | + $this->getGitData()->getRepo(), $ref), Request::METHOD_DELETE); |
|
| 102 | 102 | |
| 103 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 104 | - return true; |
|
| 105 | - } |
|
| 103 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 104 | + return true; |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - return false; |
|
| 108 | - } |
|
| 107 | + return false; |
|
| 108 | + } |
|
| 109 | 109 | } |
| 110 | 110 | \ No newline at end of file |
@@ -12,56 +12,56 @@ |
||
| 12 | 12 | class Trees extends AbstractGitData |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Get a Tree |
|
| 17 | - * |
|
| 18 | - * @link https://developer.github.com/v3/git/trees/#get-a-tree |
|
| 19 | - * |
|
| 20 | - * @param string $sha |
|
| 21 | - * |
|
| 22 | - * @return array |
|
| 23 | - * @throws \Exception |
|
| 24 | - */ |
|
| 25 | - public function get(string $sha): array |
|
| 26 | - { |
|
| 27 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/trees/:sha', |
|
| 28 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
| 29 | - } |
|
| 15 | + /** |
|
| 16 | + * Get a Tree |
|
| 17 | + * |
|
| 18 | + * @link https://developer.github.com/v3/git/trees/#get-a-tree |
|
| 19 | + * |
|
| 20 | + * @param string $sha |
|
| 21 | + * |
|
| 22 | + * @return array |
|
| 23 | + * @throws \Exception |
|
| 24 | + */ |
|
| 25 | + public function get(string $sha): array |
|
| 26 | + { |
|
| 27 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/trees/:sha', |
|
| 28 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Get a Tree Recursively |
|
| 33 | - * |
|
| 34 | - * @link https://developer.github.com/v3/git/trees/#get-a-tree-recursively |
|
| 35 | - * |
|
| 36 | - * @param string $sha |
|
| 37 | - * |
|
| 38 | - * @return array |
|
| 39 | - * @throws \Exception |
|
| 40 | - */ |
|
| 41 | - public function getRecursively(string $sha): array |
|
| 42 | - { |
|
| 43 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/trees/:sha?recursive=1', |
|
| 44 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
| 45 | - } |
|
| 31 | + /** |
|
| 32 | + * Get a Tree Recursively |
|
| 33 | + * |
|
| 34 | + * @link https://developer.github.com/v3/git/trees/#get-a-tree-recursively |
|
| 35 | + * |
|
| 36 | + * @param string $sha |
|
| 37 | + * |
|
| 38 | + * @return array |
|
| 39 | + * @throws \Exception |
|
| 40 | + */ |
|
| 41 | + public function getRecursively(string $sha): array |
|
| 42 | + { |
|
| 43 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/trees/:sha?recursive=1', |
|
| 44 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Create a Tree |
|
| 49 | - * |
|
| 50 | - * @link https://developer.github.com/v3/git/trees/#create-a-tree |
|
| 51 | - * |
|
| 52 | - * @param array $tree |
|
| 53 | - * @param string $base_tree |
|
| 54 | - * |
|
| 55 | - * @return array |
|
| 56 | - * @throws \Exception |
|
| 57 | - */ |
|
| 58 | - public function create(array $tree, string $base_tree): array |
|
| 59 | - { |
|
| 60 | - return $this->getApi()->request($this->getApi() |
|
| 61 | - ->sprintf('/repos/:owner/:repo/git/trees', $this->getGitData()->getOwner(), |
|
| 62 | - $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
| 63 | - 'tree' => $tree, |
|
| 64 | - 'base_tree' => $base_tree |
|
| 65 | - ]); |
|
| 66 | - } |
|
| 47 | + /** |
|
| 48 | + * Create a Tree |
|
| 49 | + * |
|
| 50 | + * @link https://developer.github.com/v3/git/trees/#create-a-tree |
|
| 51 | + * |
|
| 52 | + * @param array $tree |
|
| 53 | + * @param string $base_tree |
|
| 54 | + * |
|
| 55 | + * @return array |
|
| 56 | + * @throws \Exception |
|
| 57 | + */ |
|
| 58 | + public function create(array $tree, string $base_tree): array |
|
| 59 | + { |
|
| 60 | + return $this->getApi()->request($this->getApi() |
|
| 61 | + ->sprintf('/repos/:owner/:repo/git/trees', $this->getGitData()->getOwner(), |
|
| 62 | + $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
| 63 | + 'tree' => $tree, |
|
| 64 | + 'base_tree' => $base_tree |
|
| 65 | + ]); |
|
| 66 | + } |
|
| 67 | 67 | } |
| 68 | 68 | \ No newline at end of file |
@@ -12,38 +12,38 @@ |
||
| 12 | 12 | class Blobs extends AbstractGitData |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Get a Blob |
|
| 17 | - * |
|
| 18 | - * @link https://developer.github.com/v3/git/blobs/#get-a-blob |
|
| 19 | - * |
|
| 20 | - * @param string $sha |
|
| 21 | - * |
|
| 22 | - * @return array |
|
| 23 | - */ |
|
| 24 | - public function getBlob(string $sha): array |
|
| 25 | - { |
|
| 26 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/blobs/:sha', |
|
| 27 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
| 28 | - } |
|
| 15 | + /** |
|
| 16 | + * Get a Blob |
|
| 17 | + * |
|
| 18 | + * @link https://developer.github.com/v3/git/blobs/#get-a-blob |
|
| 19 | + * |
|
| 20 | + * @param string $sha |
|
| 21 | + * |
|
| 22 | + * @return array |
|
| 23 | + */ |
|
| 24 | + public function getBlob(string $sha): array |
|
| 25 | + { |
|
| 26 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/blobs/:sha', |
|
| 27 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Create a Blob |
|
| 32 | - * |
|
| 33 | - * @link https://developer.github.com/v3/git/blobs/#create-a-blob |
|
| 34 | - * |
|
| 35 | - * @param string $content |
|
| 36 | - * @param string $encoding |
|
| 37 | - * |
|
| 38 | - * @return array |
|
| 39 | - */ |
|
| 40 | - public function createBlob(string $content, string $encoding = 'utf-8'): array |
|
| 41 | - { |
|
| 42 | - return $this->getApi()->request($this->getApi() |
|
| 43 | - ->sprintf('/repos/:owner/:repo/git/blobs', $this->getGitData()->getOwner(), |
|
| 44 | - $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
| 45 | - 'content' => $content, |
|
| 46 | - 'encoding' => $encoding |
|
| 47 | - ]); |
|
| 48 | - } |
|
| 30 | + /** |
|
| 31 | + * Create a Blob |
|
| 32 | + * |
|
| 33 | + * @link https://developer.github.com/v3/git/blobs/#create-a-blob |
|
| 34 | + * |
|
| 35 | + * @param string $content |
|
| 36 | + * @param string $encoding |
|
| 37 | + * |
|
| 38 | + * @return array |
|
| 39 | + */ |
|
| 40 | + public function createBlob(string $content, string $encoding = 'utf-8'): array |
|
| 41 | + { |
|
| 42 | + return $this->getApi()->request($this->getApi() |
|
| 43 | + ->sprintf('/repos/:owner/:repo/git/blobs', $this->getGitData()->getOwner(), |
|
| 44 | + $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
| 45 | + 'content' => $content, |
|
| 46 | + 'encoding' => $encoding |
|
| 47 | + ]); |
|
| 48 | + } |
|
| 49 | 49 | } |
| 50 | 50 | \ No newline at end of file |
@@ -10,11 +10,11 @@ |
||
| 10 | 10 | class Miscellaneous extends AbstractReceiver |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - /** Available sub-Receiver */ |
|
| 14 | - const EMOJIS = 'Emojis'; |
|
| 15 | - const GITIGNORE = 'Gitignore'; |
|
| 16 | - const MARKDOWN = 'Markdown'; |
|
| 17 | - const META = 'Meta'; |
|
| 18 | - const RATE_LIMIT = 'RateLimit'; |
|
| 19 | - const LICENSES = 'Licenses'; |
|
| 13 | + /** Available sub-Receiver */ |
|
| 14 | + const EMOJIS = 'Emojis'; |
|
| 15 | + const GITIGNORE = 'Gitignore'; |
|
| 16 | + const MARKDOWN = 'Markdown'; |
|
| 17 | + const META = 'Meta'; |
|
| 18 | + const RATE_LIMIT = 'RateLimit'; |
|
| 19 | + const LICENSES = 'Licenses'; |
|
| 20 | 20 | } |
| 21 | 21 | \ No newline at end of file |
@@ -13,113 +13,113 @@ |
||
| 13 | 13 | class Comments extends AbstractIssues |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * List comments on an issue |
|
| 18 | - * |
|
| 19 | - * @link https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue |
|
| 20 | - * |
|
| 21 | - * @param int $number |
|
| 22 | - * |
|
| 23 | - * @return array |
|
| 24 | - */ |
|
| 25 | - public function listIssueComments(int $number): array |
|
| 26 | - { |
|
| 27 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/comments', |
|
| 28 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number)); |
|
| 29 | - } |
|
| 16 | + /** |
|
| 17 | + * List comments on an issue |
|
| 18 | + * |
|
| 19 | + * @link https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue |
|
| 20 | + * |
|
| 21 | + * @param int $number |
|
| 22 | + * |
|
| 23 | + * @return array |
|
| 24 | + */ |
|
| 25 | + public function listIssueComments(int $number): array |
|
| 26 | + { |
|
| 27 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/comments', |
|
| 28 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number)); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * List comments in a repository |
|
| 33 | - * |
|
| 34 | - * @link https://developer.github.com/v3/issues/comments/#list-comments-in-a-repository |
|
| 35 | - * |
|
| 36 | - * @param string $sort |
|
| 37 | - * @param string $direction |
|
| 38 | - * @param string $since |
|
| 39 | - * |
|
| 40 | - * @return array |
|
| 41 | - */ |
|
| 42 | - public function listRepositoryComments(string $sort = AbstractApi::SORT_CREATED, |
|
| 43 | - string $direction = AbstractApi::DIRECTION_DESC, |
|
| 44 | - string $since = 'now'): array |
|
| 45 | - { |
|
| 46 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/comments?:args', |
|
| 47 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), http_build_query([ |
|
| 48 | - 'sort' => $sort, |
|
| 49 | - 'direction' => $direction, |
|
| 50 | - 'since' => $since |
|
| 51 | - ]))); |
|
| 52 | - } |
|
| 31 | + /** |
|
| 32 | + * List comments in a repository |
|
| 33 | + * |
|
| 34 | + * @link https://developer.github.com/v3/issues/comments/#list-comments-in-a-repository |
|
| 35 | + * |
|
| 36 | + * @param string $sort |
|
| 37 | + * @param string $direction |
|
| 38 | + * @param string $since |
|
| 39 | + * |
|
| 40 | + * @return array |
|
| 41 | + */ |
|
| 42 | + public function listRepositoryComments(string $sort = AbstractApi::SORT_CREATED, |
|
| 43 | + string $direction = AbstractApi::DIRECTION_DESC, |
|
| 44 | + string $since = 'now'): array |
|
| 45 | + { |
|
| 46 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/comments?:args', |
|
| 47 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), http_build_query([ |
|
| 48 | + 'sort' => $sort, |
|
| 49 | + 'direction' => $direction, |
|
| 50 | + 'since' => $since |
|
| 51 | + ]))); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Get a single comment |
|
| 56 | - * |
|
| 57 | - * @link https://developer.github.com/v3/issues/comments/#get-a-single-comment |
|
| 58 | - * |
|
| 59 | - * @param int $id |
|
| 60 | - * |
|
| 61 | - * @return array |
|
| 62 | - */ |
|
| 63 | - public function getComment(int $id): array |
|
| 64 | - { |
|
| 65 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/comments/:id', |
|
| 66 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $id)); |
|
| 67 | - } |
|
| 54 | + /** |
|
| 55 | + * Get a single comment |
|
| 56 | + * |
|
| 57 | + * @link https://developer.github.com/v3/issues/comments/#get-a-single-comment |
|
| 58 | + * |
|
| 59 | + * @param int $id |
|
| 60 | + * |
|
| 61 | + * @return array |
|
| 62 | + */ |
|
| 63 | + public function getComment(int $id): array |
|
| 64 | + { |
|
| 65 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/comments/:id', |
|
| 66 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $id)); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * Create a comment |
|
| 71 | - * |
|
| 72 | - * @link https://developer.github.com/v3/issues/comments/#create-a-comment |
|
| 73 | - * |
|
| 74 | - * @param int $number |
|
| 75 | - * @param string $body |
|
| 76 | - * |
|
| 77 | - * @return array |
|
| 78 | - */ |
|
| 79 | - public function createComment(int $number, string $body): array |
|
| 80 | - { |
|
| 81 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/comments', |
|
| 82 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_POST, [ |
|
| 83 | - 'body' => $body |
|
| 84 | - ]); |
|
| 85 | - } |
|
| 69 | + /** |
|
| 70 | + * Create a comment |
|
| 71 | + * |
|
| 72 | + * @link https://developer.github.com/v3/issues/comments/#create-a-comment |
|
| 73 | + * |
|
| 74 | + * @param int $number |
|
| 75 | + * @param string $body |
|
| 76 | + * |
|
| 77 | + * @return array |
|
| 78 | + */ |
|
| 79 | + public function createComment(int $number, string $body): array |
|
| 80 | + { |
|
| 81 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/comments', |
|
| 82 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_POST, [ |
|
| 83 | + 'body' => $body |
|
| 84 | + ]); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * Edit a comment |
|
| 89 | - * |
|
| 90 | - * @link https://developer.github.com/v3/issues/comments/#edit-a-comment |
|
| 91 | - * |
|
| 92 | - * @param int $id |
|
| 93 | - * @param string $body |
|
| 94 | - * |
|
| 95 | - * @return array |
|
| 96 | - */ |
|
| 97 | - public function editComment(int $id, string $body): array |
|
| 98 | - { |
|
| 99 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/comments/:id', |
|
| 100 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $id), Request::METHOD_PATCH, [ |
|
| 101 | - 'body' => $body |
|
| 102 | - ]); |
|
| 103 | - } |
|
| 87 | + /** |
|
| 88 | + * Edit a comment |
|
| 89 | + * |
|
| 90 | + * @link https://developer.github.com/v3/issues/comments/#edit-a-comment |
|
| 91 | + * |
|
| 92 | + * @param int $id |
|
| 93 | + * @param string $body |
|
| 94 | + * |
|
| 95 | + * @return array |
|
| 96 | + */ |
|
| 97 | + public function editComment(int $id, string $body): array |
|
| 98 | + { |
|
| 99 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/comments/:id', |
|
| 100 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $id), Request::METHOD_PATCH, [ |
|
| 101 | + 'body' => $body |
|
| 102 | + ]); |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * Delete a comment |
|
| 107 | - * |
|
| 108 | - * @link https://developer.github.com/v3/issues/comments/#delete-a-comment |
|
| 109 | - * |
|
| 110 | - * @param int $id |
|
| 111 | - * |
|
| 112 | - * @return bool |
|
| 113 | - */ |
|
| 114 | - public function deleteComment(int $id): bool |
|
| 115 | - { |
|
| 116 | - $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/comments/:id', |
|
| 117 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $id), Request::METHOD_DELETE); |
|
| 105 | + /** |
|
| 106 | + * Delete a comment |
|
| 107 | + * |
|
| 108 | + * @link https://developer.github.com/v3/issues/comments/#delete-a-comment |
|
| 109 | + * |
|
| 110 | + * @param int $id |
|
| 111 | + * |
|
| 112 | + * @return bool |
|
| 113 | + */ |
|
| 114 | + public function deleteComment(int $id): bool |
|
| 115 | + { |
|
| 116 | + $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/comments/:id', |
|
| 117 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $id), Request::METHOD_DELETE); |
|
| 118 | 118 | |
| 119 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 120 | - return true; |
|
| 121 | - } |
|
| 119 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 120 | + return true; |
|
| 121 | + } |
|
| 122 | 122 | |
| 123 | - return false; |
|
| 124 | - } |
|
| 123 | + return false; |
|
| 124 | + } |
|
| 125 | 125 | } |
| 126 | 126 | \ No newline at end of file |
@@ -10,45 +10,45 @@ |
||
| 10 | 10 | class Events extends AbstractIssues |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * List events for an issue |
|
| 15 | - * |
|
| 16 | - * @link https://developer.github.com/v3/issues/events/#list-events-for-an-issue |
|
| 17 | - * |
|
| 18 | - * @param int $issueNumber |
|
| 19 | - * |
|
| 20 | - * @return array |
|
| 21 | - */ |
|
| 22 | - public function listIssueEvents(int $issueNumber): array |
|
| 23 | - { |
|
| 24 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:issue_number/events', |
|
| 25 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $issueNumber)); |
|
| 26 | - } |
|
| 13 | + /** |
|
| 14 | + * List events for an issue |
|
| 15 | + * |
|
| 16 | + * @link https://developer.github.com/v3/issues/events/#list-events-for-an-issue |
|
| 17 | + * |
|
| 18 | + * @param int $issueNumber |
|
| 19 | + * |
|
| 20 | + * @return array |
|
| 21 | + */ |
|
| 22 | + public function listIssueEvents(int $issueNumber): array |
|
| 23 | + { |
|
| 24 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:issue_number/events', |
|
| 25 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $issueNumber)); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * List events for a repository |
|
| 30 | - * |
|
| 31 | - * @link https://developer.github.com/v3/issues/events/#list-events-for-a-repository |
|
| 32 | - * @return array |
|
| 33 | - */ |
|
| 34 | - public function listRepositoryEvents(): array |
|
| 35 | - { |
|
| 36 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events', |
|
| 37 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo())); |
|
| 38 | - } |
|
| 28 | + /** |
|
| 29 | + * List events for a repository |
|
| 30 | + * |
|
| 31 | + * @link https://developer.github.com/v3/issues/events/#list-events-for-a-repository |
|
| 32 | + * @return array |
|
| 33 | + */ |
|
| 34 | + public function listRepositoryEvents(): array |
|
| 35 | + { |
|
| 36 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events', |
|
| 37 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo())); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Get a single event |
|
| 42 | - * |
|
| 43 | - * @link https://developer.github.com/v3/issues/events/#get-a-single-event |
|
| 44 | - * |
|
| 45 | - * @param int $id |
|
| 46 | - * |
|
| 47 | - * @return array |
|
| 48 | - */ |
|
| 49 | - public function getEvent(int $id): array |
|
| 50 | - { |
|
| 51 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events/:id', |
|
| 52 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $id)); |
|
| 53 | - } |
|
| 40 | + /** |
|
| 41 | + * Get a single event |
|
| 42 | + * |
|
| 43 | + * @link https://developer.github.com/v3/issues/events/#get-a-single-event |
|
| 44 | + * |
|
| 45 | + * @param int $id |
|
| 46 | + * |
|
| 47 | + * @return array |
|
| 48 | + */ |
|
| 49 | + public function getEvent(int $id): array |
|
| 50 | + { |
|
| 51 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events/:id', |
|
| 52 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $id)); |
|
| 53 | + } |
|
| 54 | 54 | } |
| 55 | 55 | \ No newline at end of file |
@@ -12,194 +12,194 @@ |
||
| 12 | 12 | class Labels extends AbstractIssues |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * List all labels for this repository |
|
| 17 | - * |
|
| 18 | - * @link https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository |
|
| 19 | - * @return array |
|
| 20 | - */ |
|
| 21 | - public function listRepositoryLabels(): array |
|
| 22 | - { |
|
| 23 | - return $this->getApi()->request($this->getApi() |
|
| 24 | - ->sprintf('/repos/:owner/:repo/labels', $this->getIssues()->getOwner(), |
|
| 25 | - $this->getIssues()->getRepo())); |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Get a single label |
|
| 30 | - * |
|
| 31 | - * @link https://developer.github.com/v3/issues/labels/#get-a-single-label |
|
| 32 | - * |
|
| 33 | - * @param string $name |
|
| 34 | - * |
|
| 35 | - * @return array |
|
| 36 | - */ |
|
| 37 | - public function getLabel(string $name): array |
|
| 38 | - { |
|
| 39 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/labels/:name', |
|
| 40 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $name)); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Create a label |
|
| 45 | - * |
|
| 46 | - * @link https://developer.github.com/v3/issues/labels/#create-a-label |
|
| 47 | - * |
|
| 48 | - * @param string $name |
|
| 49 | - * @param string $color |
|
| 50 | - * |
|
| 51 | - * @return array |
|
| 52 | - */ |
|
| 53 | - public function createLabel(string $name, string $color): array |
|
| 54 | - { |
|
| 55 | - return $this->getApi()->request($this->getApi() |
|
| 56 | - ->sprintf('/repos/:owner/:repo/labels', $this->getIssues()->getOwner(), |
|
| 57 | - $this->getIssues()->getRepo()), Request::METHOD_POST, [ |
|
| 58 | - 'name' => $name, |
|
| 59 | - 'color' => $color |
|
| 60 | - ]); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Update a label |
|
| 65 | - * |
|
| 66 | - * @link https://developer.github.com/v3/issues/labels/#update-a-label |
|
| 67 | - * |
|
| 68 | - * @param string $name |
|
| 69 | - * @param string $color |
|
| 70 | - * |
|
| 71 | - * @return array |
|
| 72 | - */ |
|
| 73 | - public function updateLabel(string $name, string $color): array |
|
| 74 | - { |
|
| 75 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/labels/:name', |
|
| 76 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $name), Request::METHOD_PATCH, [ |
|
| 77 | - 'color' => $color |
|
| 78 | - ]); |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - /** |
|
| 82 | - * Delete a label |
|
| 83 | - * |
|
| 84 | - * @link https://developer.github.com/v3/issues/labels/#delete-a-label |
|
| 85 | - * |
|
| 86 | - * @param string $name |
|
| 87 | - * |
|
| 88 | - * @return bool |
|
| 89 | - */ |
|
| 90 | - public function deleteLabel(string $name): bool |
|
| 91 | - { |
|
| 92 | - $this->getApi()->request($this->getApi() |
|
| 93 | - ->sprintf('/repos/:owner/:repo/labels/:name', $this->getIssues()->getOwner(), |
|
| 94 | - $this->getIssues()->getRepo(), $name)); |
|
| 95 | - |
|
| 96 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 97 | - return true; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - return false; |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * List labels on an issue |
|
| 105 | - * |
|
| 106 | - * @link https://developer.github.com/v3/issues/labels/#list-labels-on-an-issue |
|
| 107 | - * |
|
| 108 | - * @param int $number |
|
| 109 | - * |
|
| 110 | - * @return array |
|
| 111 | - */ |
|
| 112 | - public function listIssueLabels(int $number): array |
|
| 113 | - { |
|
| 114 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/labels', |
|
| 115 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number)); |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - /** |
|
| 119 | - * Add labels to an issue |
|
| 120 | - * |
|
| 121 | - * @link https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue |
|
| 122 | - * |
|
| 123 | - * @param int $number |
|
| 124 | - * |
|
| 125 | - * @return array |
|
| 126 | - */ |
|
| 127 | - public function addIssueLabels(int $number): array |
|
| 128 | - { |
|
| 129 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/labels', |
|
| 130 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_POST); |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * Remove a label from an issue |
|
| 135 | - * |
|
| 136 | - * @link https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue |
|
| 137 | - * |
|
| 138 | - * @param int $number |
|
| 139 | - * @param string $name |
|
| 140 | - * |
|
| 141 | - * @return bool |
|
| 142 | - */ |
|
| 143 | - public function removeIssueLabel(int $number, string $name): bool |
|
| 144 | - { |
|
| 145 | - $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/labels/:name', |
|
| 146 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number, $name), Request::METHOD_DELETE); |
|
| 147 | - |
|
| 148 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 149 | - return true; |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - return false; |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * Replace all labels for an issue |
|
| 157 | - * |
|
| 158 | - * @link https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue |
|
| 159 | - * |
|
| 160 | - * @param int $number |
|
| 161 | - * |
|
| 162 | - * @return array |
|
| 163 | - */ |
|
| 164 | - public function replaceIssuesLabels(int $number): array |
|
| 165 | - { |
|
| 166 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/labels', |
|
| 167 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_PUT); |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * Remove all labels from an issue |
|
| 172 | - * |
|
| 173 | - * @link https://developer.github.com/v3/issues/labels/#remove-all-labels-from-an-issue |
|
| 174 | - * |
|
| 175 | - * @param int $number |
|
| 176 | - * |
|
| 177 | - * @return bool |
|
| 178 | - */ |
|
| 179 | - public function removeIssueLabels(int $number): bool |
|
| 180 | - { |
|
| 181 | - $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/labels', |
|
| 182 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_DELETE); |
|
| 183 | - |
|
| 184 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 185 | - return true; |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - return false; |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - /** |
|
| 192 | - * Get labels for every issue in a milestone |
|
| 193 | - * |
|
| 194 | - * @link https://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone |
|
| 195 | - * |
|
| 196 | - * @param int $number |
|
| 197 | - * |
|
| 198 | - * @return array |
|
| 199 | - */ |
|
| 200 | - public function getIssueLabelsInMilestone(int $number): array |
|
| 201 | - { |
|
| 202 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/milestones/:number/labels', |
|
| 203 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number)); |
|
| 204 | - } |
|
| 15 | + /** |
|
| 16 | + * List all labels for this repository |
|
| 17 | + * |
|
| 18 | + * @link https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository |
|
| 19 | + * @return array |
|
| 20 | + */ |
|
| 21 | + public function listRepositoryLabels(): array |
|
| 22 | + { |
|
| 23 | + return $this->getApi()->request($this->getApi() |
|
| 24 | + ->sprintf('/repos/:owner/:repo/labels', $this->getIssues()->getOwner(), |
|
| 25 | + $this->getIssues()->getRepo())); |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Get a single label |
|
| 30 | + * |
|
| 31 | + * @link https://developer.github.com/v3/issues/labels/#get-a-single-label |
|
| 32 | + * |
|
| 33 | + * @param string $name |
|
| 34 | + * |
|
| 35 | + * @return array |
|
| 36 | + */ |
|
| 37 | + public function getLabel(string $name): array |
|
| 38 | + { |
|
| 39 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/labels/:name', |
|
| 40 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $name)); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * Create a label |
|
| 45 | + * |
|
| 46 | + * @link https://developer.github.com/v3/issues/labels/#create-a-label |
|
| 47 | + * |
|
| 48 | + * @param string $name |
|
| 49 | + * @param string $color |
|
| 50 | + * |
|
| 51 | + * @return array |
|
| 52 | + */ |
|
| 53 | + public function createLabel(string $name, string $color): array |
|
| 54 | + { |
|
| 55 | + return $this->getApi()->request($this->getApi() |
|
| 56 | + ->sprintf('/repos/:owner/:repo/labels', $this->getIssues()->getOwner(), |
|
| 57 | + $this->getIssues()->getRepo()), Request::METHOD_POST, [ |
|
| 58 | + 'name' => $name, |
|
| 59 | + 'color' => $color |
|
| 60 | + ]); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Update a label |
|
| 65 | + * |
|
| 66 | + * @link https://developer.github.com/v3/issues/labels/#update-a-label |
|
| 67 | + * |
|
| 68 | + * @param string $name |
|
| 69 | + * @param string $color |
|
| 70 | + * |
|
| 71 | + * @return array |
|
| 72 | + */ |
|
| 73 | + public function updateLabel(string $name, string $color): array |
|
| 74 | + { |
|
| 75 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/labels/:name', |
|
| 76 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $name), Request::METHOD_PATCH, [ |
|
| 77 | + 'color' => $color |
|
| 78 | + ]); |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + /** |
|
| 82 | + * Delete a label |
|
| 83 | + * |
|
| 84 | + * @link https://developer.github.com/v3/issues/labels/#delete-a-label |
|
| 85 | + * |
|
| 86 | + * @param string $name |
|
| 87 | + * |
|
| 88 | + * @return bool |
|
| 89 | + */ |
|
| 90 | + public function deleteLabel(string $name): bool |
|
| 91 | + { |
|
| 92 | + $this->getApi()->request($this->getApi() |
|
| 93 | + ->sprintf('/repos/:owner/:repo/labels/:name', $this->getIssues()->getOwner(), |
|
| 94 | + $this->getIssues()->getRepo(), $name)); |
|
| 95 | + |
|
| 96 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 97 | + return true; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + return false; |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * List labels on an issue |
|
| 105 | + * |
|
| 106 | + * @link https://developer.github.com/v3/issues/labels/#list-labels-on-an-issue |
|
| 107 | + * |
|
| 108 | + * @param int $number |
|
| 109 | + * |
|
| 110 | + * @return array |
|
| 111 | + */ |
|
| 112 | + public function listIssueLabels(int $number): array |
|
| 113 | + { |
|
| 114 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/labels', |
|
| 115 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number)); |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + /** |
|
| 119 | + * Add labels to an issue |
|
| 120 | + * |
|
| 121 | + * @link https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue |
|
| 122 | + * |
|
| 123 | + * @param int $number |
|
| 124 | + * |
|
| 125 | + * @return array |
|
| 126 | + */ |
|
| 127 | + public function addIssueLabels(int $number): array |
|
| 128 | + { |
|
| 129 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/labels', |
|
| 130 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_POST); |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * Remove a label from an issue |
|
| 135 | + * |
|
| 136 | + * @link https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue |
|
| 137 | + * |
|
| 138 | + * @param int $number |
|
| 139 | + * @param string $name |
|
| 140 | + * |
|
| 141 | + * @return bool |
|
| 142 | + */ |
|
| 143 | + public function removeIssueLabel(int $number, string $name): bool |
|
| 144 | + { |
|
| 145 | + $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/labels/:name', |
|
| 146 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number, $name), Request::METHOD_DELETE); |
|
| 147 | + |
|
| 148 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 149 | + return true; |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + return false; |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * Replace all labels for an issue |
|
| 157 | + * |
|
| 158 | + * @link https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue |
|
| 159 | + * |
|
| 160 | + * @param int $number |
|
| 161 | + * |
|
| 162 | + * @return array |
|
| 163 | + */ |
|
| 164 | + public function replaceIssuesLabels(int $number): array |
|
| 165 | + { |
|
| 166 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/labels', |
|
| 167 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_PUT); |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * Remove all labels from an issue |
|
| 172 | + * |
|
| 173 | + * @link https://developer.github.com/v3/issues/labels/#remove-all-labels-from-an-issue |
|
| 174 | + * |
|
| 175 | + * @param int $number |
|
| 176 | + * |
|
| 177 | + * @return bool |
|
| 178 | + */ |
|
| 179 | + public function removeIssueLabels(int $number): bool |
|
| 180 | + { |
|
| 181 | + $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/labels', |
|
| 182 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_DELETE); |
|
| 183 | + |
|
| 184 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 185 | + return true; |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + return false; |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + /** |
|
| 192 | + * Get labels for every issue in a milestone |
|
| 193 | + * |
|
| 194 | + * @link https://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone |
|
| 195 | + * |
|
| 196 | + * @param int $number |
|
| 197 | + * |
|
| 198 | + * @return array |
|
| 199 | + */ |
|
| 200 | + public function getIssueLabelsInMilestone(int $number): array |
|
| 201 | + { |
|
| 202 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/milestones/:number/labels', |
|
| 203 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number)); |
|
| 204 | + } |
|
| 205 | 205 | } |
| 206 | 206 | \ No newline at end of file |
@@ -14,111 +14,111 @@ |
||
| 14 | 14 | class Milestones extends AbstractIssues |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * List milestones for a repository |
|
| 19 | - * |
|
| 20 | - * @link https://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository |
|
| 21 | - * |
|
| 22 | - * @param string $state |
|
| 23 | - * @param string $sort |
|
| 24 | - * @param string $direction |
|
| 25 | - * |
|
| 26 | - * @return array |
|
| 27 | - */ |
|
| 28 | - public function listMilestones(string $state = AbstractApi::STATE_OPEN, string $sort = AbstractApi::SORT_DUE_DATE, |
|
| 29 | - string $direction = AbstractApi::DIRECTION_ASC): array |
|
| 30 | - { |
|
| 31 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/milestones?:args', |
|
| 32 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), http_build_query([ |
|
| 33 | - 'state' => $state, |
|
| 34 | - 'sort' => $sort, |
|
| 35 | - 'direction' => $direction |
|
| 36 | - ]))); |
|
| 37 | - } |
|
| 17 | + /** |
|
| 18 | + * List milestones for a repository |
|
| 19 | + * |
|
| 20 | + * @link https://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository |
|
| 21 | + * |
|
| 22 | + * @param string $state |
|
| 23 | + * @param string $sort |
|
| 24 | + * @param string $direction |
|
| 25 | + * |
|
| 26 | + * @return array |
|
| 27 | + */ |
|
| 28 | + public function listMilestones(string $state = AbstractApi::STATE_OPEN, string $sort = AbstractApi::SORT_DUE_DATE, |
|
| 29 | + string $direction = AbstractApi::DIRECTION_ASC): array |
|
| 30 | + { |
|
| 31 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/milestones?:args', |
|
| 32 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), http_build_query([ |
|
| 33 | + 'state' => $state, |
|
| 34 | + 'sort' => $sort, |
|
| 35 | + 'direction' => $direction |
|
| 36 | + ]))); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Get a single milestone |
|
| 41 | - * |
|
| 42 | - * @link https://developer.github.com/v3/issues/milestones/#get-a-single-milestone |
|
| 43 | - * |
|
| 44 | - * @param int $number |
|
| 45 | - * |
|
| 46 | - * @return array |
|
| 47 | - */ |
|
| 48 | - public function getMilestone(int $number): array |
|
| 49 | - { |
|
| 50 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/milestones/:number', |
|
| 51 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number)); |
|
| 52 | - } |
|
| 39 | + /** |
|
| 40 | + * Get a single milestone |
|
| 41 | + * |
|
| 42 | + * @link https://developer.github.com/v3/issues/milestones/#get-a-single-milestone |
|
| 43 | + * |
|
| 44 | + * @param int $number |
|
| 45 | + * |
|
| 46 | + * @return array |
|
| 47 | + */ |
|
| 48 | + public function getMilestone(int $number): array |
|
| 49 | + { |
|
| 50 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/milestones/:number', |
|
| 51 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number)); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Create a milestone |
|
| 56 | - * |
|
| 57 | - * @link https://developer.github.com/v3/issues/milestones/#create-a-milestone |
|
| 58 | - * |
|
| 59 | - * @param string $title |
|
| 60 | - * @param string $state |
|
| 61 | - * @param string $description |
|
| 62 | - * @param string $dueOn |
|
| 63 | - * |
|
| 64 | - * @return array |
|
| 65 | - */ |
|
| 66 | - public function createMilestone(string $title, string $state = AbstractApi::STATE_OPEN, string $description = '', |
|
| 67 | - string $dueOn = ''): array |
|
| 68 | - { |
|
| 69 | - return $this->getApi()->request($this->getApi() |
|
| 70 | - ->sprintf('/repos/:owner/:repo/milestones', $this->getIssues()->getOwner(), |
|
| 71 | - $this->getIssues()->getRepo()), Request::METHOD_POST, [ |
|
| 72 | - 'title' => $title, |
|
| 73 | - 'state' => $state, |
|
| 74 | - 'description' => $description, |
|
| 75 | - 'due_on' => (new DateTime($dueOn))->format(DateTime::ATOM) |
|
| 76 | - ]); |
|
| 77 | - } |
|
| 54 | + /** |
|
| 55 | + * Create a milestone |
|
| 56 | + * |
|
| 57 | + * @link https://developer.github.com/v3/issues/milestones/#create-a-milestone |
|
| 58 | + * |
|
| 59 | + * @param string $title |
|
| 60 | + * @param string $state |
|
| 61 | + * @param string $description |
|
| 62 | + * @param string $dueOn |
|
| 63 | + * |
|
| 64 | + * @return array |
|
| 65 | + */ |
|
| 66 | + public function createMilestone(string $title, string $state = AbstractApi::STATE_OPEN, string $description = '', |
|
| 67 | + string $dueOn = ''): array |
|
| 68 | + { |
|
| 69 | + return $this->getApi()->request($this->getApi() |
|
| 70 | + ->sprintf('/repos/:owner/:repo/milestones', $this->getIssues()->getOwner(), |
|
| 71 | + $this->getIssues()->getRepo()), Request::METHOD_POST, [ |
|
| 72 | + 'title' => $title, |
|
| 73 | + 'state' => $state, |
|
| 74 | + 'description' => $description, |
|
| 75 | + 'due_on' => (new DateTime($dueOn))->format(DateTime::ATOM) |
|
| 76 | + ]); |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * Update a milestone |
|
| 81 | - * |
|
| 82 | - * @link https://developer.github.com/v3/issues/milestones/#update-a-milestone |
|
| 83 | - * |
|
| 84 | - * @param int $number |
|
| 85 | - * @param string $title |
|
| 86 | - * @param string $state |
|
| 87 | - * @param string $description |
|
| 88 | - * @param string $dueOn |
|
| 89 | - * |
|
| 90 | - * @return array |
|
| 91 | - */ |
|
| 92 | - public function updateMilestone(int $number, string $title = '', string $state = AbstractApi::STATE_OPEN, |
|
| 93 | - string $description = '', string $dueOn = ''): array |
|
| 94 | - { |
|
| 95 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/milestones/:number', |
|
| 96 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_PATCH, [ |
|
| 97 | - 'title' => $title, |
|
| 98 | - 'state' => $state, |
|
| 99 | - 'description' => $description, |
|
| 100 | - 'due_on' => (new DateTime($dueOn))->format(DateTime::ATOM) |
|
| 101 | - ]); |
|
| 102 | - } |
|
| 79 | + /** |
|
| 80 | + * Update a milestone |
|
| 81 | + * |
|
| 82 | + * @link https://developer.github.com/v3/issues/milestones/#update-a-milestone |
|
| 83 | + * |
|
| 84 | + * @param int $number |
|
| 85 | + * @param string $title |
|
| 86 | + * @param string $state |
|
| 87 | + * @param string $description |
|
| 88 | + * @param string $dueOn |
|
| 89 | + * |
|
| 90 | + * @return array |
|
| 91 | + */ |
|
| 92 | + public function updateMilestone(int $number, string $title = '', string $state = AbstractApi::STATE_OPEN, |
|
| 93 | + string $description = '', string $dueOn = ''): array |
|
| 94 | + { |
|
| 95 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/milestones/:number', |
|
| 96 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_PATCH, [ |
|
| 97 | + 'title' => $title, |
|
| 98 | + 'state' => $state, |
|
| 99 | + 'description' => $description, |
|
| 100 | + 'due_on' => (new DateTime($dueOn))->format(DateTime::ATOM) |
|
| 101 | + ]); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * Delete a milestone |
|
| 106 | - * |
|
| 107 | - * @link https://developer.github.com/v3/issues/milestones/#delete-a-milestone |
|
| 108 | - * |
|
| 109 | - * @param int $number |
|
| 110 | - * |
|
| 111 | - * @return bool |
|
| 112 | - */ |
|
| 113 | - public function deleteMilestone(int $number): bool |
|
| 114 | - { |
|
| 115 | - $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/milestones/:number', |
|
| 116 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_DELETE); |
|
| 104 | + /** |
|
| 105 | + * Delete a milestone |
|
| 106 | + * |
|
| 107 | + * @link https://developer.github.com/v3/issues/milestones/#delete-a-milestone |
|
| 108 | + * |
|
| 109 | + * @param int $number |
|
| 110 | + * |
|
| 111 | + * @return bool |
|
| 112 | + */ |
|
| 113 | + public function deleteMilestone(int $number): bool |
|
| 114 | + { |
|
| 115 | + $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/milestones/:number', |
|
| 116 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_DELETE); |
|
| 117 | 117 | |
| 118 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 119 | - return true; |
|
| 120 | - } |
|
| 118 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 119 | + return true; |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - return false; |
|
| 123 | - } |
|
| 122 | + return false; |
|
| 123 | + } |
|
| 124 | 124 | } |
| 125 | 125 | \ No newline at end of file |
@@ -10,37 +10,37 @@ |
||
| 10 | 10 | class Assignees extends AbstractIssues |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * List assignees |
|
| 15 | - * |
|
| 16 | - * @link https://developer.github.com/v3/issues/assignees/#list-assignees |
|
| 17 | - * @return array |
|
| 18 | - */ |
|
| 19 | - public function listAssignees(): array |
|
| 20 | - { |
|
| 21 | - return $this->getApi()->request($this->getApi() |
|
| 22 | - ->sprintf('/repos/:owner/:repo/assignees', $this->getIssues()->getOwner(), |
|
| 23 | - $this->getIssues()->getRepo())); |
|
| 24 | - } |
|
| 13 | + /** |
|
| 14 | + * List assignees |
|
| 15 | + * |
|
| 16 | + * @link https://developer.github.com/v3/issues/assignees/#list-assignees |
|
| 17 | + * @return array |
|
| 18 | + */ |
|
| 19 | + public function listAssignees(): array |
|
| 20 | + { |
|
| 21 | + return $this->getApi()->request($this->getApi() |
|
| 22 | + ->sprintf('/repos/:owner/:repo/assignees', $this->getIssues()->getOwner(), |
|
| 23 | + $this->getIssues()->getRepo())); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Check assignee |
|
| 28 | - * |
|
| 29 | - * @link https://developer.github.com/v3/issues/assignees/#check-assignee |
|
| 30 | - * |
|
| 31 | - * @param string $assignee |
|
| 32 | - * |
|
| 33 | - * @return bool |
|
| 34 | - */ |
|
| 35 | - public function checkAssignee(string $assignee): bool |
|
| 36 | - { |
|
| 37 | - $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/assignees/:assignee', |
|
| 38 | - $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $assignee)); |
|
| 26 | + /** |
|
| 27 | + * Check assignee |
|
| 28 | + * |
|
| 29 | + * @link https://developer.github.com/v3/issues/assignees/#check-assignee |
|
| 30 | + * |
|
| 31 | + * @param string $assignee |
|
| 32 | + * |
|
| 33 | + * @return bool |
|
| 34 | + */ |
|
| 35 | + public function checkAssignee(string $assignee): bool |
|
| 36 | + { |
|
| 37 | + $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/assignees/:assignee', |
|
| 38 | + $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $assignee)); |
|
| 39 | 39 | |
| 40 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 41 | - return true; |
|
| 42 | - } |
|
| 40 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
| 41 | + return true; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - return false; |
|
| 45 | - } |
|
| 44 | + return false; |
|
| 45 | + } |
|
| 46 | 46 | } |
| 47 | 47 | \ No newline at end of file |