@@ -11,14 +11,14 @@ |
||
11 | 11 | class Meta extends AbstractMiscellaneous |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * Meta, provides information about GitHub.com, the service. |
|
16 | - * |
|
17 | - * @link https://developer.github.com/v3/meta/#meta |
|
18 | - * @return array |
|
19 | - */ |
|
20 | - public function get(): array |
|
21 | - { |
|
22 | - return $this->getApi()->request('/meta'); |
|
23 | - } |
|
14 | + /** |
|
15 | + * Meta, provides information about GitHub.com, the service. |
|
16 | + * |
|
17 | + * @link https://developer.github.com/v3/meta/#meta |
|
18 | + * @return array |
|
19 | + */ |
|
20 | + public function get(): array |
|
21 | + { |
|
22 | + return $this->getApi()->request('/meta'); |
|
23 | + } |
|
24 | 24 | } |
25 | 25 | \ No newline at end of file |
@@ -10,14 +10,14 @@ |
||
10 | 10 | class RateLimit extends AbstractMiscellaneous |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * Check your current rate limit status at any time using the Rate Limit API described below. |
|
15 | - * |
|
16 | - * @link https://developer.github.com/v3/rate_limit/#rate-limit |
|
17 | - * @return array |
|
18 | - */ |
|
19 | - public function get(): array |
|
20 | - { |
|
21 | - return $this->getApi()->request('/rate_limit'); |
|
22 | - } |
|
13 | + /** |
|
14 | + * Check your current rate limit status at any time using the Rate Limit API described below. |
|
15 | + * |
|
16 | + * @link https://developer.github.com/v3/rate_limit/#rate-limit |
|
17 | + * @return array |
|
18 | + */ |
|
19 | + public function get(): array |
|
20 | + { |
|
21 | + return $this->getApi()->request('/rate_limit'); |
|
22 | + } |
|
23 | 23 | } |
24 | 24 | \ No newline at end of file |
@@ -13,30 +13,30 @@ |
||
13 | 13 | class Licenses extends AbstractMiscellaneous |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * List all licenses |
|
18 | - * |
|
19 | - * @link https://developer.github.com/v3/licenses/#list-all-licenses |
|
20 | - * @return array |
|
21 | - */ |
|
22 | - public function listAllLicenses(): array |
|
23 | - { |
|
24 | - return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request('/licenses'); |
|
25 | - } |
|
16 | + /** |
|
17 | + * List all licenses |
|
18 | + * |
|
19 | + * @link https://developer.github.com/v3/licenses/#list-all-licenses |
|
20 | + * @return array |
|
21 | + */ |
|
22 | + public function listAllLicenses(): array |
|
23 | + { |
|
24 | + return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request('/licenses'); |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * Get an individual license |
|
29 | - * |
|
30 | - * @link https://developer.github.com/v3/licenses/#get-an-individual-license |
|
31 | - * |
|
32 | - * @param string $license |
|
33 | - * |
|
34 | - * @return array |
|
35 | - */ |
|
36 | - public function getIndividualLicense(string $license): array |
|
37 | - { |
|
38 | - return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request($this->getApi() |
|
39 | - ->sprintf('/licenses/:license', |
|
40 | - $license)); |
|
41 | - } |
|
27 | + /** |
|
28 | + * Get an individual license |
|
29 | + * |
|
30 | + * @link https://developer.github.com/v3/licenses/#get-an-individual-license |
|
31 | + * |
|
32 | + * @param string $license |
|
33 | + * |
|
34 | + * @return array |
|
35 | + */ |
|
36 | + public function getIndividualLicense(string $license): array |
|
37 | + { |
|
38 | + return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request($this->getApi() |
|
39 | + ->sprintf('/licenses/:license', |
|
40 | + $license)); |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | \ No newline at end of file |
@@ -10,14 +10,14 @@ |
||
10 | 10 | class Feeds extends AbstractActivity |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * List Feeds |
|
15 | - * |
|
16 | - * @link https://developer.github.com/v3/activity/feeds/#list-feeds |
|
17 | - * @return array |
|
18 | - */ |
|
19 | - public function listFeeds(): array |
|
20 | - { |
|
21 | - return $this->getApi()->request(sprintf('/feeds')); |
|
22 | - } |
|
13 | + /** |
|
14 | + * List Feeds |
|
15 | + * |
|
16 | + * @link https://developer.github.com/v3/activity/feeds/#list-feeds |
|
17 | + * @return array |
|
18 | + */ |
|
19 | + public function listFeeds(): array |
|
20 | + { |
|
21 | + return $this->getApi()->request(sprintf('/feeds')); |
|
22 | + } |
|
23 | 23 | } |
24 | 24 | \ No newline at end of file |
@@ -13,143 +13,143 @@ |
||
13 | 13 | class Watching extends AbstractActivity |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * List watchers |
|
18 | - * |
|
19 | - * @link https://developer.github.com/v3/activity/watching/#list-watchers |
|
20 | - * @return array |
|
21 | - */ |
|
22 | - public function listWatchers(): array |
|
23 | - { |
|
24 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/subscribers', |
|
25 | - $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
26 | - } |
|
27 | - |
|
28 | - /** |
|
29 | - * List repositories being watched |
|
30 | - * |
|
31 | - * @link https://developer.github.com/v3/activity/watching/#list-repositories-being-watched |
|
32 | - * |
|
33 | - * @param string $username |
|
34 | - * |
|
35 | - * @return array |
|
36 | - */ |
|
37 | - public function listSubscriptions(string $username = null): array |
|
38 | - { |
|
39 | - if (null !== $username) { |
|
40 | - return $this->getApi()->request($this->getApi()->sprintf('/users/:username/subscriptions', |
|
41 | - $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), $username)); |
|
42 | - } |
|
43 | - |
|
44 | - return $this->getApi()->request($this->getApi() |
|
45 | - ->sprintf('/user/subscriptions', $this->getActivity()->getOwner(), |
|
46 | - $this->getActivity()->getRepo())); |
|
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * Get a Repository Subscription |
|
51 | - * |
|
52 | - * @link https://developer.github.com/v3/activity/watching/#get-a-repository-subscription |
|
53 | - * @return array |
|
54 | - */ |
|
55 | - public function getRepositorySubscription(): array |
|
56 | - { |
|
57 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/subscription', |
|
58 | - $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * Set a Repository Subscription |
|
63 | - * |
|
64 | - * @link https://developer.github.com/v3/activity/watching/#set-a-repository-subscription |
|
65 | - * |
|
66 | - * @param bool $subscribed |
|
67 | - * @param bool $ignored |
|
68 | - * |
|
69 | - * @return array |
|
70 | - */ |
|
71 | - public function setRepositorySubscription(bool $subscribed = false, bool $ignored = false): array |
|
72 | - { |
|
73 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/subscription?:args', |
|
74 | - $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), http_build_query([ |
|
75 | - 'subscribed' => $subscribed, |
|
76 | - 'ignored' => $ignored |
|
77 | - ])), Request::METHOD_PUT); |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * Delete a Repository Subscription |
|
82 | - * |
|
83 | - * @link https://developer.github.com/v3/activity/watching/#delete-a-repository-subscription |
|
84 | - * @return bool |
|
85 | - */ |
|
86 | - public function deleteRepositorySubscription(): bool |
|
87 | - { |
|
88 | - $this->getApi()->request($this->getApi() |
|
89 | - ->sprintf('/repos/:owner/:repo/subscription', $this->getActivity()->getOwner(), |
|
90 | - $this->getActivity()->getRepo()), Request::METHOD_DELETE); |
|
91 | - |
|
92 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
93 | - return true; |
|
94 | - } |
|
95 | - |
|
96 | - return false; |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * Check if you are watching a repository (LEGACY) |
|
101 | - * |
|
102 | - * @link https://developer.github.com/v3/activity/watching/#check-if-you-are-watching-a-repository-legacy |
|
103 | - * @return bool |
|
104 | - */ |
|
105 | - public function userSubscriptions(): bool |
|
106 | - { |
|
107 | - $this->getApi()->request($this->getApi() |
|
108 | - ->sprintf('/user/subscriptions/:owner/:repo', $this->getActivity()->getOwner(), |
|
109 | - $this->getActivity()->getRepo())); |
|
110 | - |
|
111 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
112 | - return true; |
|
113 | - } |
|
114 | - |
|
115 | - return false; |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * Watch a repository (LEGACY) |
|
120 | - * |
|
121 | - * @link https://developer.github.com/v3/activity/watching/#watch-a-repository-legacy |
|
122 | - * @return bool |
|
123 | - */ |
|
124 | - public function watchRepository(): bool |
|
125 | - { |
|
126 | - $this->getApi()->request($this->getApi() |
|
127 | - ->sprintf('/user/subscriptions/:owner/:repo', $this->getActivity()->getOwner(), |
|
128 | - $this->getActivity()->getRepo()), Request::METHOD_PUT); |
|
129 | - |
|
130 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
131 | - return true; |
|
132 | - } |
|
133 | - |
|
134 | - return false; |
|
135 | - } |
|
136 | - |
|
137 | - /** |
|
138 | - * Stop watching a repository (LEGACY) |
|
139 | - * |
|
140 | - * @link https://developer.github.com/v3/activity/watching/#stop-watching-a-repository-legacy |
|
141 | - * @return bool |
|
142 | - */ |
|
143 | - public function stopWatchingRepository(): bool |
|
144 | - { |
|
145 | - $this->getApi()->request($this->getApi() |
|
146 | - ->sprintf('/user/subscriptions/:owner/:repo', $this->getActivity()->getOwner(), |
|
147 | - $this->getActivity()->getRepo()), Request::METHOD_DELETE); |
|
148 | - |
|
149 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
150 | - return true; |
|
151 | - } |
|
152 | - |
|
153 | - return false; |
|
154 | - } |
|
16 | + /** |
|
17 | + * List watchers |
|
18 | + * |
|
19 | + * @link https://developer.github.com/v3/activity/watching/#list-watchers |
|
20 | + * @return array |
|
21 | + */ |
|
22 | + public function listWatchers(): array |
|
23 | + { |
|
24 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/subscribers', |
|
25 | + $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
26 | + } |
|
27 | + |
|
28 | + /** |
|
29 | + * List repositories being watched |
|
30 | + * |
|
31 | + * @link https://developer.github.com/v3/activity/watching/#list-repositories-being-watched |
|
32 | + * |
|
33 | + * @param string $username |
|
34 | + * |
|
35 | + * @return array |
|
36 | + */ |
|
37 | + public function listSubscriptions(string $username = null): array |
|
38 | + { |
|
39 | + if (null !== $username) { |
|
40 | + return $this->getApi()->request($this->getApi()->sprintf('/users/:username/subscriptions', |
|
41 | + $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), $username)); |
|
42 | + } |
|
43 | + |
|
44 | + return $this->getApi()->request($this->getApi() |
|
45 | + ->sprintf('/user/subscriptions', $this->getActivity()->getOwner(), |
|
46 | + $this->getActivity()->getRepo())); |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * Get a Repository Subscription |
|
51 | + * |
|
52 | + * @link https://developer.github.com/v3/activity/watching/#get-a-repository-subscription |
|
53 | + * @return array |
|
54 | + */ |
|
55 | + public function getRepositorySubscription(): array |
|
56 | + { |
|
57 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/subscription', |
|
58 | + $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * Set a Repository Subscription |
|
63 | + * |
|
64 | + * @link https://developer.github.com/v3/activity/watching/#set-a-repository-subscription |
|
65 | + * |
|
66 | + * @param bool $subscribed |
|
67 | + * @param bool $ignored |
|
68 | + * |
|
69 | + * @return array |
|
70 | + */ |
|
71 | + public function setRepositorySubscription(bool $subscribed = false, bool $ignored = false): array |
|
72 | + { |
|
73 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/subscription?:args', |
|
74 | + $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), http_build_query([ |
|
75 | + 'subscribed' => $subscribed, |
|
76 | + 'ignored' => $ignored |
|
77 | + ])), Request::METHOD_PUT); |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * Delete a Repository Subscription |
|
82 | + * |
|
83 | + * @link https://developer.github.com/v3/activity/watching/#delete-a-repository-subscription |
|
84 | + * @return bool |
|
85 | + */ |
|
86 | + public function deleteRepositorySubscription(): bool |
|
87 | + { |
|
88 | + $this->getApi()->request($this->getApi() |
|
89 | + ->sprintf('/repos/:owner/:repo/subscription', $this->getActivity()->getOwner(), |
|
90 | + $this->getActivity()->getRepo()), Request::METHOD_DELETE); |
|
91 | + |
|
92 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
93 | + return true; |
|
94 | + } |
|
95 | + |
|
96 | + return false; |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * Check if you are watching a repository (LEGACY) |
|
101 | + * |
|
102 | + * @link https://developer.github.com/v3/activity/watching/#check-if-you-are-watching-a-repository-legacy |
|
103 | + * @return bool |
|
104 | + */ |
|
105 | + public function userSubscriptions(): bool |
|
106 | + { |
|
107 | + $this->getApi()->request($this->getApi() |
|
108 | + ->sprintf('/user/subscriptions/:owner/:repo', $this->getActivity()->getOwner(), |
|
109 | + $this->getActivity()->getRepo())); |
|
110 | + |
|
111 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
112 | + return true; |
|
113 | + } |
|
114 | + |
|
115 | + return false; |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * Watch a repository (LEGACY) |
|
120 | + * |
|
121 | + * @link https://developer.github.com/v3/activity/watching/#watch-a-repository-legacy |
|
122 | + * @return bool |
|
123 | + */ |
|
124 | + public function watchRepository(): bool |
|
125 | + { |
|
126 | + $this->getApi()->request($this->getApi() |
|
127 | + ->sprintf('/user/subscriptions/:owner/:repo', $this->getActivity()->getOwner(), |
|
128 | + $this->getActivity()->getRepo()), Request::METHOD_PUT); |
|
129 | + |
|
130 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
131 | + return true; |
|
132 | + } |
|
133 | + |
|
134 | + return false; |
|
135 | + } |
|
136 | + |
|
137 | + /** |
|
138 | + * Stop watching a repository (LEGACY) |
|
139 | + * |
|
140 | + * @link https://developer.github.com/v3/activity/watching/#stop-watching-a-repository-legacy |
|
141 | + * @return bool |
|
142 | + */ |
|
143 | + public function stopWatchingRepository(): bool |
|
144 | + { |
|
145 | + $this->getApi()->request($this->getApi() |
|
146 | + ->sprintf('/user/subscriptions/:owner/:repo', $this->getActivity()->getOwner(), |
|
147 | + $this->getActivity()->getRepo()), Request::METHOD_DELETE); |
|
148 | + |
|
149 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
150 | + return true; |
|
151 | + } |
|
152 | + |
|
153 | + return false; |
|
154 | + } |
|
155 | 155 | } |
156 | 156 | \ No newline at end of file |
@@ -13,95 +13,95 @@ |
||
13 | 13 | class Starring extends AbstractActivity |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * List Stargazers |
|
18 | - * |
|
19 | - * @link https://developer.github.com/v3/activity/starring/#list-stargazers |
|
20 | - * @return array |
|
21 | - */ |
|
22 | - public function listStargazers(): array |
|
23 | - { |
|
24 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stargazers', |
|
25 | - $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
26 | - } |
|
16 | + /** |
|
17 | + * List Stargazers |
|
18 | + * |
|
19 | + * @link https://developer.github.com/v3/activity/starring/#list-stargazers |
|
20 | + * @return array |
|
21 | + */ |
|
22 | + public function listStargazers(): array |
|
23 | + { |
|
24 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stargazers', |
|
25 | + $this->getActivity()->getOwner(), $this->getActivity()->getRepo())); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * List repositories being starred |
|
30 | - * |
|
31 | - * @link https://developer.github.com/v3/activity/starring/#list-repositories-being-starred |
|
32 | - * |
|
33 | - * @param string $sort |
|
34 | - * @param string $direction |
|
35 | - * @param string $username |
|
36 | - * |
|
37 | - * @return array |
|
38 | - */ |
|
39 | - public function listRepositories(string $sort = AbstractApi::SORT_CREATED, |
|
40 | - string $direction = AbstractApi::DIRECTION_DESC, string $username = null): array |
|
41 | - { |
|
42 | - if (null !== $username) { |
|
43 | - return $this->getApi()->request($this->getApi()->sprintf('/users/:username/starred?:args', $username, |
|
44 | - http_build_query(['sort' => $sort, 'direction' => $direction]))); |
|
45 | - } |
|
28 | + /** |
|
29 | + * List repositories being starred |
|
30 | + * |
|
31 | + * @link https://developer.github.com/v3/activity/starring/#list-repositories-being-starred |
|
32 | + * |
|
33 | + * @param string $sort |
|
34 | + * @param string $direction |
|
35 | + * @param string $username |
|
36 | + * |
|
37 | + * @return array |
|
38 | + */ |
|
39 | + public function listRepositories(string $sort = AbstractApi::SORT_CREATED, |
|
40 | + string $direction = AbstractApi::DIRECTION_DESC, string $username = null): array |
|
41 | + { |
|
42 | + if (null !== $username) { |
|
43 | + return $this->getApi()->request($this->getApi()->sprintf('/users/:username/starred?:args', $username, |
|
44 | + http_build_query(['sort' => $sort, 'direction' => $direction]))); |
|
45 | + } |
|
46 | 46 | |
47 | - return $this->getApi()->request($this->getApi()->sprintf('/user/starred?:args', |
|
48 | - http_build_query(['sort' => $sort, 'direction' => $direction]))); |
|
49 | - } |
|
47 | + return $this->getApi()->request($this->getApi()->sprintf('/user/starred?:args', |
|
48 | + http_build_query(['sort' => $sort, 'direction' => $direction]))); |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Check if you are starring a repository |
|
53 | - * |
|
54 | - * @link https://developer.github.com/v3/activity/starring/#check-if-you-are-starring-a-repository |
|
55 | - * @return bool |
|
56 | - */ |
|
57 | - public function checkYouAreStarringRepository(): bool |
|
58 | - { |
|
59 | - $this->getApi()->request($this->getApi() |
|
60 | - ->sprintf('/user/starred/:owner/:repo', $this->getActivity()->getOwner(), |
|
61 | - $this->getActivity()->getRepo())); |
|
51 | + /** |
|
52 | + * Check if you are starring a repository |
|
53 | + * |
|
54 | + * @link https://developer.github.com/v3/activity/starring/#check-if-you-are-starring-a-repository |
|
55 | + * @return bool |
|
56 | + */ |
|
57 | + public function checkYouAreStarringRepository(): bool |
|
58 | + { |
|
59 | + $this->getApi()->request($this->getApi() |
|
60 | + ->sprintf('/user/starred/:owner/:repo', $this->getActivity()->getOwner(), |
|
61 | + $this->getActivity()->getRepo())); |
|
62 | 62 | |
63 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
64 | - return true; |
|
65 | - } |
|
63 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
64 | + return true; |
|
65 | + } |
|
66 | 66 | |
67 | - return false; |
|
68 | - } |
|
67 | + return false; |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * Star a repository |
|
72 | - * |
|
73 | - * @link https://developer.github.com/v3/activity/starring/#star-a-repository |
|
74 | - * @return bool |
|
75 | - */ |
|
76 | - public function starRepository(): bool |
|
77 | - { |
|
78 | - $this->getApi()->request($this->getApi() |
|
79 | - ->sprintf('/user/starred/:owner/:repo', $this->getActivity()->getOwner(), |
|
80 | - $this->getActivity()->getRepo()), Request::METHOD_PUT); |
|
70 | + /** |
|
71 | + * Star a repository |
|
72 | + * |
|
73 | + * @link https://developer.github.com/v3/activity/starring/#star-a-repository |
|
74 | + * @return bool |
|
75 | + */ |
|
76 | + public function starRepository(): bool |
|
77 | + { |
|
78 | + $this->getApi()->request($this->getApi() |
|
79 | + ->sprintf('/user/starred/:owner/:repo', $this->getActivity()->getOwner(), |
|
80 | + $this->getActivity()->getRepo()), Request::METHOD_PUT); |
|
81 | 81 | |
82 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
83 | - return true; |
|
84 | - } |
|
82 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
83 | + return true; |
|
84 | + } |
|
85 | 85 | |
86 | - return false; |
|
87 | - } |
|
86 | + return false; |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * Unstar a repository |
|
91 | - * |
|
92 | - * @link https://developer.github.com/v3/activity/starring/#unstar-a-repository |
|
93 | - * @return bool |
|
94 | - */ |
|
95 | - public function unStarRepository(): bool |
|
96 | - { |
|
97 | - $this->getApi()->request($this->getApi() |
|
98 | - ->sprintf('/user/starred/:owner/:repo', $this->getActivity()->getOwner(), |
|
99 | - $this->getActivity()->getRepo()), Request::METHOD_DELETE); |
|
89 | + /** |
|
90 | + * Unstar a repository |
|
91 | + * |
|
92 | + * @link https://developer.github.com/v3/activity/starring/#unstar-a-repository |
|
93 | + * @return bool |
|
94 | + */ |
|
95 | + public function unStarRepository(): bool |
|
96 | + { |
|
97 | + $this->getApi()->request($this->getApi() |
|
98 | + ->sprintf('/user/starred/:owner/:repo', $this->getActivity()->getOwner(), |
|
99 | + $this->getActivity()->getRepo()), Request::METHOD_DELETE); |
|
100 | 100 | |
101 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
102 | - return true; |
|
103 | - } |
|
101 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
102 | + return true; |
|
103 | + } |
|
104 | 104 | |
105 | - return false; |
|
106 | - } |
|
105 | + return false; |
|
106 | + } |
|
107 | 107 | } |
108 | 108 | \ No newline at end of file |
@@ -14,126 +14,126 @@ |
||
14 | 14 | class ReviewComments extends AbstractPullRequests |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * List comments on a pull request |
|
19 | - * |
|
20 | - * @link https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request |
|
21 | - * |
|
22 | - * @param int $number |
|
23 | - * |
|
24 | - * @return array |
|
25 | - * @throws \Exception |
|
26 | - */ |
|
27 | - public function listCommentsPullRequest(int $number): array |
|
28 | - { |
|
29 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number/comments', |
|
30 | - $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number)); |
|
31 | - } |
|
17 | + /** |
|
18 | + * List comments on a pull request |
|
19 | + * |
|
20 | + * @link https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request |
|
21 | + * |
|
22 | + * @param int $number |
|
23 | + * |
|
24 | + * @return array |
|
25 | + * @throws \Exception |
|
26 | + */ |
|
27 | + public function listCommentsPullRequest(int $number): array |
|
28 | + { |
|
29 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number/comments', |
|
30 | + $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number)); |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * List comments in a repository |
|
35 | - * |
|
36 | - * @link https://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository |
|
37 | - * |
|
38 | - * @param string $sort |
|
39 | - * @param string $direction |
|
40 | - * @param string $since |
|
41 | - * |
|
42 | - * @return array |
|
43 | - * @throws \Exception |
|
44 | - */ |
|
45 | - public function listCommentsRepository(string $sort = AbstractApi::SORT_CREATED, |
|
46 | - string $direction = AbstractApi::DIRECTION_DESC, |
|
47 | - string $since = 'now'): array |
|
48 | - { |
|
49 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/comments?:args', |
|
50 | - $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), http_build_query([ |
|
51 | - 'sort' => $sort, |
|
52 | - 'direction' => $direction, |
|
53 | - 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
54 | - ]))); |
|
55 | - } |
|
33 | + /** |
|
34 | + * List comments in a repository |
|
35 | + * |
|
36 | + * @link https://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository |
|
37 | + * |
|
38 | + * @param string $sort |
|
39 | + * @param string $direction |
|
40 | + * @param string $since |
|
41 | + * |
|
42 | + * @return array |
|
43 | + * @throws \Exception |
|
44 | + */ |
|
45 | + public function listCommentsRepository(string $sort = AbstractApi::SORT_CREATED, |
|
46 | + string $direction = AbstractApi::DIRECTION_DESC, |
|
47 | + string $since = 'now'): array |
|
48 | + { |
|
49 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/comments?:args', |
|
50 | + $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), http_build_query([ |
|
51 | + 'sort' => $sort, |
|
52 | + 'direction' => $direction, |
|
53 | + 'since' => (new DateTime($since))->format(DateTime::ATOM) |
|
54 | + ]))); |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * Get a single comment |
|
59 | - * |
|
60 | - * @link https://developer.github.com/v3/pulls/comments/#get-a-single-comment |
|
61 | - * |
|
62 | - * @param int $number |
|
63 | - * |
|
64 | - * @return array |
|
65 | - * @throws \Exception |
|
66 | - */ |
|
67 | - public function getSingleComment(int $number): array |
|
68 | - { |
|
69 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/comments/:number', |
|
70 | - $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number)); |
|
71 | - } |
|
57 | + /** |
|
58 | + * Get a single comment |
|
59 | + * |
|
60 | + * @link https://developer.github.com/v3/pulls/comments/#get-a-single-comment |
|
61 | + * |
|
62 | + * @param int $number |
|
63 | + * |
|
64 | + * @return array |
|
65 | + * @throws \Exception |
|
66 | + */ |
|
67 | + public function getSingleComment(int $number): array |
|
68 | + { |
|
69 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/comments/:number', |
|
70 | + $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number)); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Create a comment |
|
75 | - * |
|
76 | - * @link https://developer.github.com/v3/pulls/comments/#create-a-comment |
|
77 | - * |
|
78 | - * @param int $number |
|
79 | - * @param string $body |
|
80 | - * @param string $commitId |
|
81 | - * @param string $path |
|
82 | - * @param int $position |
|
83 | - * |
|
84 | - * @return array |
|
85 | - * @throws \Exception |
|
86 | - */ |
|
87 | - public function createComment(int $number, string $body, string $commitId, string $path, int $position): array |
|
88 | - { |
|
89 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number/comments', |
|
90 | - $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number), Request::METHOD_POST, [ |
|
91 | - 'body' => $body, |
|
92 | - 'commit_id' => $commitId, |
|
93 | - 'path' => $path, |
|
94 | - 'position' => $position |
|
95 | - ]); |
|
96 | - } |
|
73 | + /** |
|
74 | + * Create a comment |
|
75 | + * |
|
76 | + * @link https://developer.github.com/v3/pulls/comments/#create-a-comment |
|
77 | + * |
|
78 | + * @param int $number |
|
79 | + * @param string $body |
|
80 | + * @param string $commitId |
|
81 | + * @param string $path |
|
82 | + * @param int $position |
|
83 | + * |
|
84 | + * @return array |
|
85 | + * @throws \Exception |
|
86 | + */ |
|
87 | + public function createComment(int $number, string $body, string $commitId, string $path, int $position): array |
|
88 | + { |
|
89 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/:number/comments', |
|
90 | + $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number), Request::METHOD_POST, [ |
|
91 | + 'body' => $body, |
|
92 | + 'commit_id' => $commitId, |
|
93 | + 'path' => $path, |
|
94 | + 'position' => $position |
|
95 | + ]); |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
99 | - * Edit a comment |
|
100 | - * |
|
101 | - * @link https://developer.github.com/v3/pulls/comments/#edit-a-comment |
|
102 | - * |
|
103 | - * @param int $number |
|
104 | - * @param string $body |
|
105 | - * |
|
106 | - * @return array |
|
107 | - * @throws \Exception |
|
108 | - */ |
|
109 | - public function editComment(int $number, string $body): array |
|
110 | - { |
|
111 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/comments/:number', |
|
112 | - $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number), Request::METHOD_PATCH, |
|
113 | - [ |
|
114 | - 'body' => $body |
|
115 | - ]); |
|
116 | - } |
|
98 | + /** |
|
99 | + * Edit a comment |
|
100 | + * |
|
101 | + * @link https://developer.github.com/v3/pulls/comments/#edit-a-comment |
|
102 | + * |
|
103 | + * @param int $number |
|
104 | + * @param string $body |
|
105 | + * |
|
106 | + * @return array |
|
107 | + * @throws \Exception |
|
108 | + */ |
|
109 | + public function editComment(int $number, string $body): array |
|
110 | + { |
|
111 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/comments/:number', |
|
112 | + $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number), Request::METHOD_PATCH, |
|
113 | + [ |
|
114 | + 'body' => $body |
|
115 | + ]); |
|
116 | + } |
|
117 | 117 | |
118 | - /** |
|
119 | - * Delete a comment |
|
120 | - * |
|
121 | - * @link https://developer.github.com/v3/pulls/comments/#delete-a-comment |
|
122 | - * |
|
123 | - * @param int $number |
|
124 | - * |
|
125 | - * @return bool |
|
126 | - * @throws \Exception |
|
127 | - */ |
|
128 | - public function deleteComment(int $number): bool |
|
129 | - { |
|
130 | - $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/comments/:number', |
|
131 | - $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number)); |
|
118 | + /** |
|
119 | + * Delete a comment |
|
120 | + * |
|
121 | + * @link https://developer.github.com/v3/pulls/comments/#delete-a-comment |
|
122 | + * |
|
123 | + * @param int $number |
|
124 | + * |
|
125 | + * @return bool |
|
126 | + * @throws \Exception |
|
127 | + */ |
|
128 | + public function deleteComment(int $number): bool |
|
129 | + { |
|
130 | + $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/pulls/comments/:number', |
|
131 | + $this->getPullRequests()->getOwner(), $this->getPullRequests()->getRepo(), $number)); |
|
132 | 132 | |
133 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
134 | - return true; |
|
135 | - } |
|
133 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
134 | + return true; |
|
135 | + } |
|
136 | 136 | |
137 | - return false; |
|
138 | - } |
|
137 | + return false; |
|
138 | + } |
|
139 | 139 | } |
140 | 140 | \ No newline at end of file |
@@ -12,103 +12,103 @@ |
||
12 | 12 | class Comments extends AbstractRepositories |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * List commit comments for a repository |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository |
|
19 | - * @return array |
|
20 | - */ |
|
21 | - public function listComments(): array |
|
22 | - { |
|
23 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments', |
|
24 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
25 | - } |
|
15 | + /** |
|
16 | + * List commit comments for a repository |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository |
|
19 | + * @return array |
|
20 | + */ |
|
21 | + public function listComments(): array |
|
22 | + { |
|
23 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments', |
|
24 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo())); |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * List comments for a single commit |
|
29 | - * |
|
30 | - * @link https://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit |
|
31 | - * |
|
32 | - * @param string $ref |
|
33 | - * |
|
34 | - * @return array |
|
35 | - */ |
|
36 | - public function listCommitComments(string $ref): array |
|
37 | - { |
|
38 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits/:ref/comments', |
|
39 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $ref)); |
|
40 | - } |
|
27 | + /** |
|
28 | + * List comments for a single commit |
|
29 | + * |
|
30 | + * @link https://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit |
|
31 | + * |
|
32 | + * @param string $ref |
|
33 | + * |
|
34 | + * @return array |
|
35 | + */ |
|
36 | + public function listCommitComments(string $ref): array |
|
37 | + { |
|
38 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits/:ref/comments', |
|
39 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $ref)); |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Create a commit comment |
|
44 | - * |
|
45 | - * @link https://developer.github.com/v3/repos/comments/#create-a-commit-comment |
|
46 | - * |
|
47 | - * @param string $sha |
|
48 | - * @param string $body |
|
49 | - * @param string $path |
|
50 | - * @param int $position |
|
51 | - * |
|
52 | - * @return array |
|
53 | - */ |
|
54 | - public function addCommitComment(string $sha, string $body, string $path = '', int $position = 0): array |
|
55 | - { |
|
56 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits/:sha/comments', |
|
57 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $sha), Request::METHOD_POST, [ |
|
58 | - 'body' => $body, |
|
59 | - 'path' => $path, |
|
60 | - 'position' => $position |
|
61 | - ]); |
|
62 | - } |
|
42 | + /** |
|
43 | + * Create a commit comment |
|
44 | + * |
|
45 | + * @link https://developer.github.com/v3/repos/comments/#create-a-commit-comment |
|
46 | + * |
|
47 | + * @param string $sha |
|
48 | + * @param string $body |
|
49 | + * @param string $path |
|
50 | + * @param int $position |
|
51 | + * |
|
52 | + * @return array |
|
53 | + */ |
|
54 | + public function addCommitComment(string $sha, string $body, string $path = '', int $position = 0): array |
|
55 | + { |
|
56 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/commits/:sha/comments', |
|
57 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $sha), Request::METHOD_POST, [ |
|
58 | + 'body' => $body, |
|
59 | + 'path' => $path, |
|
60 | + 'position' => $position |
|
61 | + ]); |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * Get a single commit comment |
|
66 | - * |
|
67 | - * @link https://developer.github.com/v3/repos/comments/#get-a-single-commit-comment |
|
68 | - * |
|
69 | - * @param int $id |
|
70 | - * |
|
71 | - * @return array |
|
72 | - */ |
|
73 | - public function getCommitComment(int $id): array |
|
74 | - { |
|
75 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments/:id', |
|
76 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), (string)$id)); |
|
77 | - } |
|
64 | + /** |
|
65 | + * Get a single commit comment |
|
66 | + * |
|
67 | + * @link https://developer.github.com/v3/repos/comments/#get-a-single-commit-comment |
|
68 | + * |
|
69 | + * @param int $id |
|
70 | + * |
|
71 | + * @return array |
|
72 | + */ |
|
73 | + public function getCommitComment(int $id): array |
|
74 | + { |
|
75 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments/:id', |
|
76 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), (string)$id)); |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * Update a commit comment |
|
81 | - * |
|
82 | - * @link https://developer.github.com/v3/repos/comments/#update-a-commit-comment |
|
83 | - * |
|
84 | - * @param int $id |
|
85 | - * @param string $body |
|
86 | - * |
|
87 | - * @return array |
|
88 | - * @throws \Exception |
|
89 | - */ |
|
90 | - public function updateCommitComment(int $id, string $body): array |
|
91 | - { |
|
92 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments/:id', |
|
93 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), (string)$id), |
|
94 | - Request::METHOD_PATCH, [ |
|
95 | - 'body' => $body |
|
96 | - ]); |
|
97 | - } |
|
79 | + /** |
|
80 | + * Update a commit comment |
|
81 | + * |
|
82 | + * @link https://developer.github.com/v3/repos/comments/#update-a-commit-comment |
|
83 | + * |
|
84 | + * @param int $id |
|
85 | + * @param string $body |
|
86 | + * |
|
87 | + * @return array |
|
88 | + * @throws \Exception |
|
89 | + */ |
|
90 | + public function updateCommitComment(int $id, string $body): array |
|
91 | + { |
|
92 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments/:id', |
|
93 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), (string)$id), |
|
94 | + Request::METHOD_PATCH, [ |
|
95 | + 'body' => $body |
|
96 | + ]); |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * Delete a commit comment |
|
101 | - * |
|
102 | - * @link https://developer.github.com/v3/repos/comments/#delete-a-commit-comment |
|
103 | - * |
|
104 | - * @param int $id |
|
105 | - * |
|
106 | - * @return array |
|
107 | - */ |
|
108 | - public function deleteCommitComment(int $id): array |
|
109 | - { |
|
110 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments/:id', |
|
111 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), (string)$id), |
|
112 | - Request::METHOD_DELETE); |
|
113 | - } |
|
99 | + /** |
|
100 | + * Delete a commit comment |
|
101 | + * |
|
102 | + * @link https://developer.github.com/v3/repos/comments/#delete-a-commit-comment |
|
103 | + * |
|
104 | + * @param int $id |
|
105 | + * |
|
106 | + * @return array |
|
107 | + */ |
|
108 | + public function deleteCommitComment(int $id): array |
|
109 | + { |
|
110 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments/:id', |
|
111 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), (string)$id), |
|
112 | + Request::METHOD_DELETE); |
|
113 | + } |
|
114 | 114 | } |
115 | 115 | \ No newline at end of file |
@@ -13,35 +13,35 @@ |
||
13 | 13 | class Forks extends AbstractRepositories |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * List forks |
|
18 | - * |
|
19 | - * @link https://developer.github.com/v3/repos/forks/#list-forks |
|
20 | - * |
|
21 | - * @param string $sort |
|
22 | - * |
|
23 | - * @return array |
|
24 | - */ |
|
25 | - public function listForks(string $sort = AbstractApi::SORT_NEWEST): array |
|
26 | - { |
|
27 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/forks?:arg', |
|
28 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), |
|
29 | - http_build_query(['sort' => $sort]))); |
|
30 | - } |
|
16 | + /** |
|
17 | + * List forks |
|
18 | + * |
|
19 | + * @link https://developer.github.com/v3/repos/forks/#list-forks |
|
20 | + * |
|
21 | + * @param string $sort |
|
22 | + * |
|
23 | + * @return array |
|
24 | + */ |
|
25 | + public function listForks(string $sort = AbstractApi::SORT_NEWEST): array |
|
26 | + { |
|
27 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/forks?:arg', |
|
28 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), |
|
29 | + http_build_query(['sort' => $sort]))); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * Create a fork |
|
34 | - * |
|
35 | - * @link https://developer.github.com/v3/repos/forks/#create-a-fork |
|
36 | - * |
|
37 | - * @param string $organization |
|
38 | - * |
|
39 | - * @return array |
|
40 | - */ |
|
41 | - public function createFork(string $organization = ''): array |
|
42 | - { |
|
43 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/forks', |
|
44 | - $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, |
|
45 | - ['organization' => $organization]); |
|
46 | - } |
|
32 | + /** |
|
33 | + * Create a fork |
|
34 | + * |
|
35 | + * @link https://developer.github.com/v3/repos/forks/#create-a-fork |
|
36 | + * |
|
37 | + * @param string $organization |
|
38 | + * |
|
39 | + * @return array |
|
40 | + */ |
|
41 | + public function createFork(string $organization = ''): array |
|
42 | + { |
|
43 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/forks', |
|
44 | + $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, |
|
45 | + ['organization' => $organization]); |
|
46 | + } |
|
47 | 47 | } |
48 | 48 | \ No newline at end of file |