@@ -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,66 +12,66 @@ |
||
12 | 12 | abstract class AbstractGitData |
13 | 13 | { |
14 | 14 | |
15 | - /** Properties */ |
|
16 | - protected $gitData; |
|
17 | - protected $api; |
|
15 | + /** Properties */ |
|
16 | + protected $gitData; |
|
17 | + protected $api; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Constructor |
|
21 | - * |
|
22 | - * @param GitData $gitData |
|
23 | - */ |
|
24 | - public function __construct(GitData $gitData) |
|
25 | - { |
|
26 | - $this->setGitData($gitData); |
|
27 | - $this->setApi($gitData->getApi()); |
|
28 | - } |
|
19 | + /** |
|
20 | + * Constructor |
|
21 | + * |
|
22 | + * @param GitData $gitData |
|
23 | + */ |
|
24 | + public function __construct(GitData $gitData) |
|
25 | + { |
|
26 | + $this->setGitData($gitData); |
|
27 | + $this->setApi($gitData->getApi()); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Get gitData |
|
32 | - * |
|
33 | - * @return GitData |
|
34 | - */ |
|
35 | - public function getGitData(): GitData |
|
36 | - { |
|
37 | - return $this->gitData; |
|
38 | - } |
|
30 | + /** |
|
31 | + * Get gitData |
|
32 | + * |
|
33 | + * @return GitData |
|
34 | + */ |
|
35 | + public function getGitData(): GitData |
|
36 | + { |
|
37 | + return $this->gitData; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Set gitData |
|
42 | - * |
|
43 | - * @param GitData $gitData |
|
44 | - * |
|
45 | - * @return AbstractGitData |
|
46 | - */ |
|
47 | - public function setGitData(GitData $gitData): AbstractGitData |
|
48 | - { |
|
49 | - $this->gitData = $gitData; |
|
40 | + /** |
|
41 | + * Set gitData |
|
42 | + * |
|
43 | + * @param GitData $gitData |
|
44 | + * |
|
45 | + * @return AbstractGitData |
|
46 | + */ |
|
47 | + public function setGitData(GitData $gitData): AbstractGitData |
|
48 | + { |
|
49 | + $this->gitData = $gitData; |
|
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 AbstractGitData |
|
70 | - */ |
|
71 | - public function setApi(AbstractApi $api): AbstractGitData |
|
72 | - { |
|
73 | - $this->api = $api; |
|
64 | + /** |
|
65 | + * Set api |
|
66 | + * |
|
67 | + * @param AbstractApi $api |
|
68 | + * |
|
69 | + * @return AbstractGitData |
|
70 | + */ |
|
71 | + public function setApi(AbstractApi $api): AbstractGitData |
|
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 |
@@ -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,65 +12,65 @@ |
||
12 | 12 | abstract class AbstractIssues |
13 | 13 | { |
14 | 14 | |
15 | - protected $issues; |
|
16 | - protected $api; |
|
15 | + protected $issues; |
|
16 | + protected $api; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Constructor |
|
20 | - * |
|
21 | - * @param Issues $issues |
|
22 | - */ |
|
23 | - public function __construct(Issues $issues) |
|
24 | - { |
|
25 | - $this->setIssues($issues); |
|
26 | - $this->setApi($issues->getApi()); |
|
27 | - } |
|
18 | + /** |
|
19 | + * Constructor |
|
20 | + * |
|
21 | + * @param Issues $issues |
|
22 | + */ |
|
23 | + public function __construct(Issues $issues) |
|
24 | + { |
|
25 | + $this->setIssues($issues); |
|
26 | + $this->setApi($issues->getApi()); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Get issues |
|
31 | - * |
|
32 | - * @return Issues |
|
33 | - */ |
|
34 | - public function getIssues(): Issues |
|
35 | - { |
|
36 | - return $this->issues; |
|
37 | - } |
|
29 | + /** |
|
30 | + * Get issues |
|
31 | + * |
|
32 | + * @return Issues |
|
33 | + */ |
|
34 | + public function getIssues(): Issues |
|
35 | + { |
|
36 | + return $this->issues; |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Set issues |
|
41 | - * |
|
42 | - * @param Issues $issues |
|
43 | - * |
|
44 | - * @return AbstractIssues |
|
45 | - */ |
|
46 | - public function setIssues(Issues $issues): AbstractIssues |
|
47 | - { |
|
48 | - $this->issues = $issues; |
|
39 | + /** |
|
40 | + * Set issues |
|
41 | + * |
|
42 | + * @param Issues $issues |
|
43 | + * |
|
44 | + * @return AbstractIssues |
|
45 | + */ |
|
46 | + public function setIssues(Issues $issues): AbstractIssues |
|
47 | + { |
|
48 | + $this->issues = $issues; |
|
49 | 49 | |
50 | - return $this; |
|
51 | - } |
|
50 | + return $this; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Get api |
|
55 | - * |
|
56 | - * @return AbstractApi |
|
57 | - */ |
|
58 | - public function getApi(): AbstractApi |
|
59 | - { |
|
60 | - return $this->api; |
|
61 | - } |
|
53 | + /** |
|
54 | + * Get api |
|
55 | + * |
|
56 | + * @return AbstractApi |
|
57 | + */ |
|
58 | + public function getApi(): AbstractApi |
|
59 | + { |
|
60 | + return $this->api; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Set api |
|
65 | - * |
|
66 | - * @param AbstractApi $api |
|
67 | - * |
|
68 | - * @return AbstractIssues |
|
69 | - */ |
|
70 | - public function setApi(AbstractApi $api): AbstractIssues |
|
71 | - { |
|
72 | - $this->api = $api; |
|
63 | + /** |
|
64 | + * Set api |
|
65 | + * |
|
66 | + * @param AbstractApi $api |
|
67 | + * |
|
68 | + * @return AbstractIssues |
|
69 | + */ |
|
70 | + public function setApi(AbstractApi $api): AbstractIssues |
|
71 | + { |
|
72 | + $this->api = $api; |
|
73 | 73 | |
74 | - return $this; |
|
75 | - } |
|
74 | + return $this; |
|
75 | + } |
|
76 | 76 | } |
77 | 77 | \ 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 |