@@ -11,10 +11,10 @@ |
||
11 | 11 | class Activity extends AbstractReceiver |
12 | 12 | { |
13 | 13 | |
14 | - /** Available sub-Receiver */ |
|
15 | - const EVENTS = 'Events'; |
|
16 | - const FEEDS = 'Feeds'; |
|
17 | - const NOTIFICATIONS = 'Notifications'; |
|
18 | - const STARRING = 'Starring'; |
|
19 | - const WATCHING = 'Watching'; |
|
14 | + /** Available sub-Receiver */ |
|
15 | + const EVENTS = 'Events'; |
|
16 | + const FEEDS = 'Feeds'; |
|
17 | + const NOTIFICATIONS = 'Notifications'; |
|
18 | + const STARRING = 'Starring'; |
|
19 | + const WATCHING = 'Watching'; |
|
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -11,10 +11,10 @@ |
||
11 | 11 | class GitData extends AbstractReceiver |
12 | 12 | { |
13 | 13 | |
14 | - /** Available sub-Receiver */ |
|
15 | - const BLOBS = 'Blobs'; |
|
16 | - const COMMITS = 'Commits'; |
|
17 | - const REFERENCES = 'References'; |
|
18 | - const TAGS = 'Tags'; |
|
19 | - const TREES = 'Trees'; |
|
14 | + /** Available sub-Receiver */ |
|
15 | + const BLOBS = 'Blobs'; |
|
16 | + const COMMITS = 'Commits'; |
|
17 | + const REFERENCES = 'References'; |
|
18 | + const TAGS = 'Tags'; |
|
19 | + const TREES = 'Trees'; |
|
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -12,264 +12,264 @@ |
||
12 | 12 | class Members extends AbstractOrganizations |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Members list |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/orgs/members/#members-list |
|
19 | - * |
|
20 | - * @param string $org |
|
21 | - * @param string $filter |
|
22 | - * @param string $role |
|
23 | - * |
|
24 | - * @return array |
|
25 | - */ |
|
26 | - public function listMembers(string $org, string $filter = AbstractApi::FILTER_ALL, string $role = 'admin'): array |
|
27 | - { |
|
28 | - $this->getApi()->setAccept('application/vnd.github.moondragon+json'); |
|
15 | + /** |
|
16 | + * Members list |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/orgs/members/#members-list |
|
19 | + * |
|
20 | + * @param string $org |
|
21 | + * @param string $filter |
|
22 | + * @param string $role |
|
23 | + * |
|
24 | + * @return array |
|
25 | + */ |
|
26 | + public function listMembers(string $org, string $filter = AbstractApi::FILTER_ALL, string $role = 'admin'): array |
|
27 | + { |
|
28 | + $this->getApi()->setAccept('application/vnd.github.moondragon+json'); |
|
29 | 29 | |
30 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/members?:args', $org, |
|
31 | - http_build_query(['filter' => $filter, 'role' => $role]))); |
|
32 | - } |
|
30 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/members?:args', $org, |
|
31 | + http_build_query(['filter' => $filter, 'role' => $role]))); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * Check membership |
|
36 | - * |
|
37 | - * @link https://developer.github.com/v3/orgs/members/#check-membership |
|
38 | - * |
|
39 | - * @param string $org |
|
40 | - * @param string $username |
|
41 | - * |
|
42 | - * @return bool |
|
43 | - * @throws \Exception |
|
44 | - */ |
|
45 | - public function checkMembership(string $org, string $username): bool |
|
46 | - { |
|
47 | - $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/members/:username', $org, $username)); |
|
34 | + /** |
|
35 | + * Check membership |
|
36 | + * |
|
37 | + * @link https://developer.github.com/v3/orgs/members/#check-membership |
|
38 | + * |
|
39 | + * @param string $org |
|
40 | + * @param string $username |
|
41 | + * |
|
42 | + * @return bool |
|
43 | + * @throws \Exception |
|
44 | + */ |
|
45 | + public function checkMembership(string $org, string $username): bool |
|
46 | + { |
|
47 | + $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/members/:username', $org, $username)); |
|
48 | 48 | |
49 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
50 | - return true; |
|
51 | - } |
|
49 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
50 | + return true; |
|
51 | + } |
|
52 | 52 | |
53 | - return false; |
|
54 | - } |
|
53 | + return false; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * Remove a member |
|
58 | - * |
|
59 | - * @link https://developer.github.com/v3/orgs/members/#remove-a-member |
|
60 | - * |
|
61 | - * @param string $org |
|
62 | - * @param string $username |
|
63 | - * |
|
64 | - * @return bool |
|
65 | - * @throws \Exception |
|
66 | - */ |
|
67 | - public function removeMember(string $org, string $username): bool |
|
68 | - { |
|
69 | - $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/members/:username', $org, $username), |
|
70 | - Request::METHOD_DELETE); |
|
56 | + /** |
|
57 | + * Remove a member |
|
58 | + * |
|
59 | + * @link https://developer.github.com/v3/orgs/members/#remove-a-member |
|
60 | + * |
|
61 | + * @param string $org |
|
62 | + * @param string $username |
|
63 | + * |
|
64 | + * @return bool |
|
65 | + * @throws \Exception |
|
66 | + */ |
|
67 | + public function removeMember(string $org, string $username): bool |
|
68 | + { |
|
69 | + $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/members/:username', $org, $username), |
|
70 | + Request::METHOD_DELETE); |
|
71 | 71 | |
72 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
73 | - return true; |
|
74 | - } |
|
72 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
73 | + return true; |
|
74 | + } |
|
75 | 75 | |
76 | - return false; |
|
77 | - } |
|
76 | + return false; |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * Public members list |
|
81 | - * |
|
82 | - * @link https://developer.github.com/v3/orgs/members/#public-members-list |
|
83 | - * |
|
84 | - * @param string $org |
|
85 | - * |
|
86 | - * @return array |
|
87 | - * @throws \Exception |
|
88 | - */ |
|
89 | - public function listPublicMembers(string $org): array |
|
90 | - { |
|
91 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/public_members', $org)); |
|
92 | - } |
|
79 | + /** |
|
80 | + * Public members list |
|
81 | + * |
|
82 | + * @link https://developer.github.com/v3/orgs/members/#public-members-list |
|
83 | + * |
|
84 | + * @param string $org |
|
85 | + * |
|
86 | + * @return array |
|
87 | + * @throws \Exception |
|
88 | + */ |
|
89 | + public function listPublicMembers(string $org): array |
|
90 | + { |
|
91 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/public_members', $org)); |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * Check public membership |
|
96 | - * |
|
97 | - * @link https://developer.github.com/v3/orgs/members/#check-public-membership |
|
98 | - * |
|
99 | - * @param string $org |
|
100 | - * @param string $username |
|
101 | - * |
|
102 | - * @return bool |
|
103 | - * @throws \Exception |
|
104 | - */ |
|
105 | - public function checkPublicMembership(string $org, string $username): bool |
|
106 | - { |
|
107 | - $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/public_members/:username', $org, $username)); |
|
94 | + /** |
|
95 | + * Check public membership |
|
96 | + * |
|
97 | + * @link https://developer.github.com/v3/orgs/members/#check-public-membership |
|
98 | + * |
|
99 | + * @param string $org |
|
100 | + * @param string $username |
|
101 | + * |
|
102 | + * @return bool |
|
103 | + * @throws \Exception |
|
104 | + */ |
|
105 | + public function checkPublicMembership(string $org, string $username): bool |
|
106 | + { |
|
107 | + $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/public_members/:username', $org, $username)); |
|
108 | 108 | |
109 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
110 | - return true; |
|
111 | - } |
|
109 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
110 | + return true; |
|
111 | + } |
|
112 | 112 | |
113 | - return false; |
|
114 | - } |
|
113 | + return false; |
|
114 | + } |
|
115 | 115 | |
116 | - /** |
|
117 | - * Publicize a user’s membership |
|
118 | - * |
|
119 | - * @link https://developer.github.com/v3/orgs/members/#publicize-a-users-membership |
|
120 | - * |
|
121 | - * @param string $org |
|
122 | - * @param string $username |
|
123 | - * |
|
124 | - * @return bool |
|
125 | - * @throws \Exception |
|
126 | - */ |
|
127 | - public function publicizeUsersMembership(string $org, string $username): bool |
|
128 | - { |
|
129 | - $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/public_members/:username', $org, $username), |
|
130 | - Request::METHOD_PUT); |
|
116 | + /** |
|
117 | + * Publicize a user’s membership |
|
118 | + * |
|
119 | + * @link https://developer.github.com/v3/orgs/members/#publicize-a-users-membership |
|
120 | + * |
|
121 | + * @param string $org |
|
122 | + * @param string $username |
|
123 | + * |
|
124 | + * @return bool |
|
125 | + * @throws \Exception |
|
126 | + */ |
|
127 | + public function publicizeUsersMembership(string $org, string $username): bool |
|
128 | + { |
|
129 | + $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/public_members/:username', $org, $username), |
|
130 | + Request::METHOD_PUT); |
|
131 | 131 | |
132 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
133 | - return true; |
|
134 | - } |
|
132 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
133 | + return true; |
|
134 | + } |
|
135 | 135 | |
136 | - return false; |
|
137 | - } |
|
136 | + return false; |
|
137 | + } |
|
138 | 138 | |
139 | - /** |
|
140 | - * Conceal a user’s membership |
|
141 | - * |
|
142 | - * @link https://developer.github.com/v3/orgs/members/#conceal-a-users-membership |
|
143 | - * |
|
144 | - * @param string $org |
|
145 | - * @param string $username |
|
146 | - * |
|
147 | - * @return bool |
|
148 | - * @throws \Exception |
|
149 | - */ |
|
150 | - public function concealUsersMembership(string $org, string $username): bool |
|
151 | - { |
|
152 | - $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/public_members/:username', $org, $username), |
|
153 | - Request::METHOD_DELETE); |
|
139 | + /** |
|
140 | + * Conceal a user’s membership |
|
141 | + * |
|
142 | + * @link https://developer.github.com/v3/orgs/members/#conceal-a-users-membership |
|
143 | + * |
|
144 | + * @param string $org |
|
145 | + * @param string $username |
|
146 | + * |
|
147 | + * @return bool |
|
148 | + * @throws \Exception |
|
149 | + */ |
|
150 | + public function concealUsersMembership(string $org, string $username): bool |
|
151 | + { |
|
152 | + $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/public_members/:username', $org, $username), |
|
153 | + Request::METHOD_DELETE); |
|
154 | 154 | |
155 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
156 | - return true; |
|
157 | - } |
|
155 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
156 | + return true; |
|
157 | + } |
|
158 | 158 | |
159 | - return false; |
|
160 | - } |
|
159 | + return false; |
|
160 | + } |
|
161 | 161 | |
162 | - /** |
|
163 | - * Get organization membership |
|
164 | - * |
|
165 | - * @link https://developer.github.com/v3/orgs/members/#get-organization-membership |
|
166 | - * |
|
167 | - * @param string $org |
|
168 | - * @param string $username |
|
169 | - * |
|
170 | - * @return array |
|
171 | - * @throws \Exception |
|
172 | - */ |
|
173 | - public function getOrganizationMembership(string $org, string $username): array |
|
174 | - { |
|
175 | - $this->getApi()->setAccept('application/vnd.github.moondragon+json'); |
|
162 | + /** |
|
163 | + * Get organization membership |
|
164 | + * |
|
165 | + * @link https://developer.github.com/v3/orgs/members/#get-organization-membership |
|
166 | + * |
|
167 | + * @param string $org |
|
168 | + * @param string $username |
|
169 | + * |
|
170 | + * @return array |
|
171 | + * @throws \Exception |
|
172 | + */ |
|
173 | + public function getOrganizationMembership(string $org, string $username): array |
|
174 | + { |
|
175 | + $this->getApi()->setAccept('application/vnd.github.moondragon+json'); |
|
176 | 176 | |
177 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/memberships/:username', $org, $username)); |
|
178 | - } |
|
177 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/memberships/:username', $org, $username)); |
|
178 | + } |
|
179 | 179 | |
180 | - /** |
|
181 | - * Add or update organization membership |
|
182 | - * |
|
183 | - * @link https://developer.github.com/v3/orgs/members/#add-or-update-organization-membership |
|
184 | - * |
|
185 | - * @param string $org |
|
186 | - * @param string $username |
|
187 | - * @param string $role |
|
188 | - * |
|
189 | - * @return array |
|
190 | - * @throws \Exception |
|
191 | - */ |
|
192 | - public function addUpdateOrganizationMembership(string $org, string $username, string $role): array |
|
193 | - { |
|
194 | - $this->getApi()->setAccept('application/vnd.github.moondragon+json'); |
|
180 | + /** |
|
181 | + * Add or update organization membership |
|
182 | + * |
|
183 | + * @link https://developer.github.com/v3/orgs/members/#add-or-update-organization-membership |
|
184 | + * |
|
185 | + * @param string $org |
|
186 | + * @param string $username |
|
187 | + * @param string $role |
|
188 | + * |
|
189 | + * @return array |
|
190 | + * @throws \Exception |
|
191 | + */ |
|
192 | + public function addUpdateOrganizationMembership(string $org, string $username, string $role): array |
|
193 | + { |
|
194 | + $this->getApi()->setAccept('application/vnd.github.moondragon+json'); |
|
195 | 195 | |
196 | - return $this->getApi()->request($this->getApi() |
|
197 | - ->sprintf('/orgs/:org/memberships/:username?:args', $org, $username, |
|
198 | - http_build_query(['role' => $role])), Request::METHOD_PUT); |
|
199 | - } |
|
196 | + return $this->getApi()->request($this->getApi() |
|
197 | + ->sprintf('/orgs/:org/memberships/:username?:args', $org, $username, |
|
198 | + http_build_query(['role' => $role])), Request::METHOD_PUT); |
|
199 | + } |
|
200 | 200 | |
201 | - /** |
|
202 | - * Remove organization membership |
|
203 | - * |
|
204 | - * @link https://developer.github.com/v3/orgs/members/#remove-organization-membership |
|
205 | - * |
|
206 | - * @param string $org |
|
207 | - * @param string $username |
|
208 | - * |
|
209 | - * @return bool |
|
210 | - * @throws \Exception |
|
211 | - */ |
|
212 | - public function removeOrganizationMembership(string $org, string $username): bool |
|
213 | - { |
|
214 | - $this->getApi()->setAccept('application/vnd.github.moondragon+json'); |
|
201 | + /** |
|
202 | + * Remove organization membership |
|
203 | + * |
|
204 | + * @link https://developer.github.com/v3/orgs/members/#remove-organization-membership |
|
205 | + * |
|
206 | + * @param string $org |
|
207 | + * @param string $username |
|
208 | + * |
|
209 | + * @return bool |
|
210 | + * @throws \Exception |
|
211 | + */ |
|
212 | + public function removeOrganizationMembership(string $org, string $username): bool |
|
213 | + { |
|
214 | + $this->getApi()->setAccept('application/vnd.github.moondragon+json'); |
|
215 | 215 | |
216 | - $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/memberships/:username', $org, $username), |
|
217 | - Request::METHOD_DELETE); |
|
216 | + $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/memberships/:username', $org, $username), |
|
217 | + Request::METHOD_DELETE); |
|
218 | 218 | |
219 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
220 | - return true; |
|
221 | - } |
|
219 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
220 | + return true; |
|
221 | + } |
|
222 | 222 | |
223 | - return false; |
|
224 | - } |
|
223 | + return false; |
|
224 | + } |
|
225 | 225 | |
226 | - /** |
|
227 | - * List your organization memberships |
|
228 | - * |
|
229 | - * @link https://developer.github.com/v3/orgs/members/#list-your-organization-memberships |
|
230 | - * |
|
231 | - * @param string|null $state |
|
232 | - * |
|
233 | - * @return array |
|
234 | - * @throws \Exception |
|
235 | - */ |
|
236 | - public function listYourOrganizationMembership(string $state = null): array |
|
237 | - { |
|
238 | - return $this->getApi()->request($this->getApi()->sprintf('/user/memberships/orgs?:args', |
|
239 | - http_build_query(['state' => $state]))); |
|
240 | - } |
|
226 | + /** |
|
227 | + * List your organization memberships |
|
228 | + * |
|
229 | + * @link https://developer.github.com/v3/orgs/members/#list-your-organization-memberships |
|
230 | + * |
|
231 | + * @param string|null $state |
|
232 | + * |
|
233 | + * @return array |
|
234 | + * @throws \Exception |
|
235 | + */ |
|
236 | + public function listYourOrganizationMembership(string $state = null): array |
|
237 | + { |
|
238 | + return $this->getApi()->request($this->getApi()->sprintf('/user/memberships/orgs?:args', |
|
239 | + http_build_query(['state' => $state]))); |
|
240 | + } |
|
241 | 241 | |
242 | - /** |
|
243 | - * Get your organization membership |
|
244 | - * |
|
245 | - * @link https://developer.github.com/v3/orgs/members/#get-your-organization-membership |
|
246 | - * |
|
247 | - * @param string $org |
|
248 | - * |
|
249 | - * @return array |
|
250 | - * @throws \Exception |
|
251 | - */ |
|
252 | - public function getYourOrganizationMembership(string $org): array |
|
253 | - { |
|
254 | - return $this->getApi()->request($this->getApi()->sprintf('/user/memberships/orgs/:org', $org)); |
|
255 | - } |
|
242 | + /** |
|
243 | + * Get your organization membership |
|
244 | + * |
|
245 | + * @link https://developer.github.com/v3/orgs/members/#get-your-organization-membership |
|
246 | + * |
|
247 | + * @param string $org |
|
248 | + * |
|
249 | + * @return array |
|
250 | + * @throws \Exception |
|
251 | + */ |
|
252 | + public function getYourOrganizationMembership(string $org): array |
|
253 | + { |
|
254 | + return $this->getApi()->request($this->getApi()->sprintf('/user/memberships/orgs/:org', $org)); |
|
255 | + } |
|
256 | 256 | |
257 | - /** |
|
258 | - * Edit your organization membership |
|
259 | - * |
|
260 | - * @link https://developer.github.com/v3/orgs/members/#edit-your-organization-membership |
|
261 | - * |
|
262 | - * @param string $org |
|
263 | - * @param string $state |
|
264 | - * |
|
265 | - * @return array |
|
266 | - * @throws \Exception |
|
267 | - */ |
|
268 | - public function editYourOrganizationMembership(string $org, string $state = AbstractApi::STATE_ACTIVE): array |
|
269 | - { |
|
270 | - return $this->getApi()->request($this->getApi()->sprintf('/user/memberships/orgs/:org', $org), |
|
271 | - Request::METHOD_PATCH, [ |
|
272 | - 'state' => $state |
|
273 | - ]); |
|
274 | - } |
|
257 | + /** |
|
258 | + * Edit your organization membership |
|
259 | + * |
|
260 | + * @link https://developer.github.com/v3/orgs/members/#edit-your-organization-membership |
|
261 | + * |
|
262 | + * @param string $org |
|
263 | + * @param string $state |
|
264 | + * |
|
265 | + * @return array |
|
266 | + * @throws \Exception |
|
267 | + */ |
|
268 | + public function editYourOrganizationMembership(string $org, string $state = AbstractApi::STATE_ACTIVE): array |
|
269 | + { |
|
270 | + return $this->getApi()->request($this->getApi()->sprintf('/user/memberships/orgs/:org', $org), |
|
271 | + Request::METHOD_PATCH, [ |
|
272 | + 'state' => $state |
|
273 | + ]); |
|
274 | + } |
|
275 | 275 | } |
276 | 276 | \ No newline at end of file |
@@ -12,268 +12,268 @@ |
||
12 | 12 | class Teams extends AbstractOrganizations |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * List teams |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/orgs/teams/#list-teams |
|
19 | - * |
|
20 | - * @param string $org |
|
21 | - * |
|
22 | - * @return array |
|
23 | - * @throws \Exception |
|
24 | - */ |
|
25 | - public function listTeams(string $org): array |
|
26 | - { |
|
27 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/teams', $org)); |
|
28 | - } |
|
15 | + /** |
|
16 | + * List teams |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/orgs/teams/#list-teams |
|
19 | + * |
|
20 | + * @param string $org |
|
21 | + * |
|
22 | + * @return array |
|
23 | + * @throws \Exception |
|
24 | + */ |
|
25 | + public function listTeams(string $org): array |
|
26 | + { |
|
27 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/teams', $org)); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Get team |
|
32 | - * |
|
33 | - * @link https://developer.github.com/v3/orgs/teams/#get-team |
|
34 | - * |
|
35 | - * @param int $id |
|
36 | - * |
|
37 | - * @return array |
|
38 | - * @throws \Exception |
|
39 | - */ |
|
40 | - public function getTeam(int $id): array |
|
41 | - { |
|
42 | - return $this->getApi()->request($this->getApi()->sprintf('/teams/:id', (string)$id)); |
|
43 | - } |
|
30 | + /** |
|
31 | + * Get team |
|
32 | + * |
|
33 | + * @link https://developer.github.com/v3/orgs/teams/#get-team |
|
34 | + * |
|
35 | + * @param int $id |
|
36 | + * |
|
37 | + * @return array |
|
38 | + * @throws \Exception |
|
39 | + */ |
|
40 | + public function getTeam(int $id): array |
|
41 | + { |
|
42 | + return $this->getApi()->request($this->getApi()->sprintf('/teams/:id', (string)$id)); |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Create team |
|
47 | - * |
|
48 | - * @link https://developer.github.com/v3/orgs/teams/#create-team |
|
49 | - * |
|
50 | - * @param string $org |
|
51 | - * @param string $name |
|
52 | - * @param null|string $description |
|
53 | - * @param array $repoNames |
|
54 | - * @param string $permission |
|
55 | - * |
|
56 | - * @return array |
|
57 | - * @throws \Exception |
|
58 | - */ |
|
59 | - public function createTeam(string $org, string $name, string $description = null, array $repoNames = [], |
|
60 | - string $permission = AbstractApi::PERMISSION_PULL): array |
|
61 | - { |
|
62 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/teams', $org), Request::METHOD_POST, [ |
|
63 | - 'name' => $name, |
|
64 | - 'description' => $description, |
|
65 | - 'repo_names' => $repoNames, |
|
66 | - 'permission' => $permission |
|
67 | - ]); |
|
68 | - } |
|
45 | + /** |
|
46 | + * Create team |
|
47 | + * |
|
48 | + * @link https://developer.github.com/v3/orgs/teams/#create-team |
|
49 | + * |
|
50 | + * @param string $org |
|
51 | + * @param string $name |
|
52 | + * @param null|string $description |
|
53 | + * @param array $repoNames |
|
54 | + * @param string $permission |
|
55 | + * |
|
56 | + * @return array |
|
57 | + * @throws \Exception |
|
58 | + */ |
|
59 | + public function createTeam(string $org, string $name, string $description = null, array $repoNames = [], |
|
60 | + string $permission = AbstractApi::PERMISSION_PULL): array |
|
61 | + { |
|
62 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/teams', $org), Request::METHOD_POST, [ |
|
63 | + 'name' => $name, |
|
64 | + 'description' => $description, |
|
65 | + 'repo_names' => $repoNames, |
|
66 | + 'permission' => $permission |
|
67 | + ]); |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * Edit team |
|
72 | - * |
|
73 | - * @link https://developer.github.com/v3/orgs/teams/#edit-team |
|
74 | - * |
|
75 | - * @param int $id |
|
76 | - * @param string $name |
|
77 | - * @param null|string $description |
|
78 | - * @param string $permission |
|
79 | - * |
|
80 | - * @return array |
|
81 | - * @throws \Exception |
|
82 | - */ |
|
83 | - public function editTeam(int $id, string $name, string $description = null, |
|
84 | - string $permission = AbstractApi::PERMISSION_PULL): array |
|
85 | - { |
|
86 | - return $this->getApi()->request($this->getApi()->sprintf('/teams/:id', (string)$id), Request::METHOD_PATCH, [ |
|
87 | - 'name' => $name, |
|
88 | - 'description' => $description, |
|
89 | - 'permission' => $permission |
|
90 | - ]); |
|
91 | - } |
|
70 | + /** |
|
71 | + * Edit team |
|
72 | + * |
|
73 | + * @link https://developer.github.com/v3/orgs/teams/#edit-team |
|
74 | + * |
|
75 | + * @param int $id |
|
76 | + * @param string $name |
|
77 | + * @param null|string $description |
|
78 | + * @param string $permission |
|
79 | + * |
|
80 | + * @return array |
|
81 | + * @throws \Exception |
|
82 | + */ |
|
83 | + public function editTeam(int $id, string $name, string $description = null, |
|
84 | + string $permission = AbstractApi::PERMISSION_PULL): array |
|
85 | + { |
|
86 | + return $this->getApi()->request($this->getApi()->sprintf('/teams/:id', (string)$id), Request::METHOD_PATCH, [ |
|
87 | + 'name' => $name, |
|
88 | + 'description' => $description, |
|
89 | + 'permission' => $permission |
|
90 | + ]); |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * Delete team |
|
95 | - * |
|
96 | - * @link https://developer.github.com/v3/orgs/teams/#delete-team |
|
97 | - * |
|
98 | - * @param int $id |
|
99 | - * |
|
100 | - * @return bool |
|
101 | - * @throws \Exception |
|
102 | - */ |
|
103 | - public function deleteTeam(int $id): bool |
|
104 | - { |
|
105 | - $this->getApi()->request($this->getApi()->sprintf('/teams/:id', (string)$id), Request::METHOD_DELETE); |
|
93 | + /** |
|
94 | + * Delete team |
|
95 | + * |
|
96 | + * @link https://developer.github.com/v3/orgs/teams/#delete-team |
|
97 | + * |
|
98 | + * @param int $id |
|
99 | + * |
|
100 | + * @return bool |
|
101 | + * @throws \Exception |
|
102 | + */ |
|
103 | + public function deleteTeam(int $id): bool |
|
104 | + { |
|
105 | + $this->getApi()->request($this->getApi()->sprintf('/teams/:id', (string)$id), Request::METHOD_DELETE); |
|
106 | 106 | |
107 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
108 | - return true; |
|
109 | - } |
|
107 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
108 | + return true; |
|
109 | + } |
|
110 | 110 | |
111 | - return false; |
|
112 | - } |
|
111 | + return false; |
|
112 | + } |
|
113 | 113 | |
114 | - /** |
|
115 | - * List team members |
|
116 | - * |
|
117 | - * @link https://developer.github.com/v3/orgs/teams/#list-team-members |
|
118 | - * |
|
119 | - * @param int $id |
|
120 | - * |
|
121 | - * @return array |
|
122 | - * @throws \Exception |
|
123 | - */ |
|
124 | - public function listTeamMembers(int $id): array |
|
125 | - { |
|
126 | - return $this->getApi()->request($this->getApi()->sprintf('/teams/:id/members', (string)$id)); |
|
127 | - } |
|
114 | + /** |
|
115 | + * List team members |
|
116 | + * |
|
117 | + * @link https://developer.github.com/v3/orgs/teams/#list-team-members |
|
118 | + * |
|
119 | + * @param int $id |
|
120 | + * |
|
121 | + * @return array |
|
122 | + * @throws \Exception |
|
123 | + */ |
|
124 | + public function listTeamMembers(int $id): array |
|
125 | + { |
|
126 | + return $this->getApi()->request($this->getApi()->sprintf('/teams/:id/members', (string)$id)); |
|
127 | + } |
|
128 | 128 | |
129 | - /** |
|
130 | - * Get team membership |
|
131 | - * |
|
132 | - * @link https://developer.github.com/v3/orgs/teams/#get-team-membership |
|
133 | - * |
|
134 | - * @param int $id |
|
135 | - * @param string $username |
|
136 | - * |
|
137 | - * @return array |
|
138 | - * @throws \Exception |
|
139 | - */ |
|
140 | - public function getTeamMembership(int $id, string $username): array |
|
141 | - { |
|
142 | - return $this->getApi()->request($this->getApi() |
|
143 | - ->sprintf('/teams/:id/memberships/:username', (string)$id, $username)); |
|
144 | - } |
|
129 | + /** |
|
130 | + * Get team membership |
|
131 | + * |
|
132 | + * @link https://developer.github.com/v3/orgs/teams/#get-team-membership |
|
133 | + * |
|
134 | + * @param int $id |
|
135 | + * @param string $username |
|
136 | + * |
|
137 | + * @return array |
|
138 | + * @throws \Exception |
|
139 | + */ |
|
140 | + public function getTeamMembership(int $id, string $username): array |
|
141 | + { |
|
142 | + return $this->getApi()->request($this->getApi() |
|
143 | + ->sprintf('/teams/:id/memberships/:username', (string)$id, $username)); |
|
144 | + } |
|
145 | 145 | |
146 | - /** |
|
147 | - * Add team membership |
|
148 | - * |
|
149 | - * @link https://developer.github.com/v3/orgs/teams/#add-team-membership |
|
150 | - * |
|
151 | - * @param int $id |
|
152 | - * @param string $username |
|
153 | - * |
|
154 | - * @return array |
|
155 | - * @throws \Exception |
|
156 | - */ |
|
157 | - public function addTeamMembership(int $id, string $username): array |
|
158 | - { |
|
159 | - return $this->getApi()->request($this->getApi() |
|
160 | - ->sprintf('/teams/:id/memberships/:username', (string)$id, $username), |
|
161 | - Request::METHOD_PUT); |
|
162 | - } |
|
146 | + /** |
|
147 | + * Add team membership |
|
148 | + * |
|
149 | + * @link https://developer.github.com/v3/orgs/teams/#add-team-membership |
|
150 | + * |
|
151 | + * @param int $id |
|
152 | + * @param string $username |
|
153 | + * |
|
154 | + * @return array |
|
155 | + * @throws \Exception |
|
156 | + */ |
|
157 | + public function addTeamMembership(int $id, string $username): array |
|
158 | + { |
|
159 | + return $this->getApi()->request($this->getApi() |
|
160 | + ->sprintf('/teams/:id/memberships/:username', (string)$id, $username), |
|
161 | + Request::METHOD_PUT); |
|
162 | + } |
|
163 | 163 | |
164 | - /** |
|
165 | - * Remove team membership |
|
166 | - * |
|
167 | - * @link https://developer.github.com/v3/orgs/teams/#remove-team-membership |
|
168 | - * |
|
169 | - * @param int $id |
|
170 | - * @param string $username |
|
171 | - * |
|
172 | - * @return bool |
|
173 | - * @throws \Exception |
|
174 | - */ |
|
175 | - public function removeTeamMembership(int $id, string $username): bool |
|
176 | - { |
|
177 | - $this->getApi()->request($this->getApi()->sprintf('/teams/:id/memberships/:username', (string)$id, $username), |
|
178 | - Request::METHOD_DELETE); |
|
164 | + /** |
|
165 | + * Remove team membership |
|
166 | + * |
|
167 | + * @link https://developer.github.com/v3/orgs/teams/#remove-team-membership |
|
168 | + * |
|
169 | + * @param int $id |
|
170 | + * @param string $username |
|
171 | + * |
|
172 | + * @return bool |
|
173 | + * @throws \Exception |
|
174 | + */ |
|
175 | + public function removeTeamMembership(int $id, string $username): bool |
|
176 | + { |
|
177 | + $this->getApi()->request($this->getApi()->sprintf('/teams/:id/memberships/:username', (string)$id, $username), |
|
178 | + Request::METHOD_DELETE); |
|
179 | 179 | |
180 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
181 | - return true; |
|
182 | - } |
|
180 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
181 | + return true; |
|
182 | + } |
|
183 | 183 | |
184 | - return false; |
|
185 | - } |
|
184 | + return false; |
|
185 | + } |
|
186 | 186 | |
187 | - /** |
|
188 | - * List team repos |
|
189 | - * |
|
190 | - * @link https://developer.github.com/v3/orgs/teams/#list-team-repos |
|
191 | - * |
|
192 | - * @param int $id |
|
193 | - * |
|
194 | - * @return array |
|
195 | - * @throws \Exception |
|
196 | - */ |
|
197 | - public function listTeamRepos(int $id): array |
|
198 | - { |
|
199 | - return $this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos', (string)$id)); |
|
200 | - } |
|
187 | + /** |
|
188 | + * List team repos |
|
189 | + * |
|
190 | + * @link https://developer.github.com/v3/orgs/teams/#list-team-repos |
|
191 | + * |
|
192 | + * @param int $id |
|
193 | + * |
|
194 | + * @return array |
|
195 | + * @throws \Exception |
|
196 | + */ |
|
197 | + public function listTeamRepos(int $id): array |
|
198 | + { |
|
199 | + return $this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos', (string)$id)); |
|
200 | + } |
|
201 | 201 | |
202 | - /** |
|
203 | - * Check if a team manages a repository |
|
204 | - * |
|
205 | - * @link https://developer.github.com/v3/orgs/teams/#get-team-repo |
|
206 | - * |
|
207 | - * @param int $id |
|
208 | - * |
|
209 | - * @return bool |
|
210 | - * @throws \Exception |
|
211 | - */ |
|
212 | - public function checkTeamManagesRepository(int $id): bool |
|
213 | - { |
|
214 | - $this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos/:owner/:repo', (string)$id, |
|
215 | - $this->getOrganizations()->getOwner(), $this->getOrganizations()->getRepo())); |
|
202 | + /** |
|
203 | + * Check if a team manages a repository |
|
204 | + * |
|
205 | + * @link https://developer.github.com/v3/orgs/teams/#get-team-repo |
|
206 | + * |
|
207 | + * @param int $id |
|
208 | + * |
|
209 | + * @return bool |
|
210 | + * @throws \Exception |
|
211 | + */ |
|
212 | + public function checkTeamManagesRepository(int $id): bool |
|
213 | + { |
|
214 | + $this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos/:owner/:repo', (string)$id, |
|
215 | + $this->getOrganizations()->getOwner(), $this->getOrganizations()->getRepo())); |
|
216 | 216 | |
217 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
218 | - return true; |
|
219 | - } |
|
217 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
218 | + return true; |
|
219 | + } |
|
220 | 220 | |
221 | - return false; |
|
222 | - } |
|
221 | + return false; |
|
222 | + } |
|
223 | 223 | |
224 | - /** |
|
225 | - * Add team repository |
|
226 | - * |
|
227 | - * @link https://developer.github.com/v3/orgs/teams/#add-team-repo |
|
228 | - * |
|
229 | - * @param int $id |
|
230 | - * |
|
231 | - * @return bool|array |
|
232 | - * @throws \Exception |
|
233 | - */ |
|
234 | - public function addTeamRepository(int $id) |
|
235 | - { |
|
236 | - $return = $this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos/:org/:repo', (string)$id, |
|
237 | - $this->getOrganizations()->getOwner(), $this->getOrganizations()->getRepo()), Request::METHOD_PUT); |
|
224 | + /** |
|
225 | + * Add team repository |
|
226 | + * |
|
227 | + * @link https://developer.github.com/v3/orgs/teams/#add-team-repo |
|
228 | + * |
|
229 | + * @param int $id |
|
230 | + * |
|
231 | + * @return bool|array |
|
232 | + * @throws \Exception |
|
233 | + */ |
|
234 | + public function addTeamRepository(int $id) |
|
235 | + { |
|
236 | + $return = $this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos/:org/:repo', (string)$id, |
|
237 | + $this->getOrganizations()->getOwner(), $this->getOrganizations()->getRepo()), Request::METHOD_PUT); |
|
238 | 238 | |
239 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
240 | - return true; |
|
241 | - } |
|
239 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
240 | + return true; |
|
241 | + } |
|
242 | 242 | |
243 | - return $return; |
|
244 | - } |
|
243 | + return $return; |
|
244 | + } |
|
245 | 245 | |
246 | - /** |
|
247 | - * Remove team repository |
|
248 | - * |
|
249 | - * @link https://developer.github.com/v3/orgs/teams/#remove-team-repo |
|
250 | - * |
|
251 | - * @param int $id |
|
252 | - * |
|
253 | - * @return bool |
|
254 | - * @throws \Exception |
|
255 | - */ |
|
256 | - public function removeTeamRepository(int $id): bool |
|
257 | - { |
|
258 | - $this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos/:owner/:repo', (string)$id, |
|
259 | - $this->getOrganizations()->getOwner(), $this->getOrganizations()->getRepo()), Request::METHOD_DELETE); |
|
246 | + /** |
|
247 | + * Remove team repository |
|
248 | + * |
|
249 | + * @link https://developer.github.com/v3/orgs/teams/#remove-team-repo |
|
250 | + * |
|
251 | + * @param int $id |
|
252 | + * |
|
253 | + * @return bool |
|
254 | + * @throws \Exception |
|
255 | + */ |
|
256 | + public function removeTeamRepository(int $id): bool |
|
257 | + { |
|
258 | + $this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos/:owner/:repo', (string)$id, |
|
259 | + $this->getOrganizations()->getOwner(), $this->getOrganizations()->getRepo()), Request::METHOD_DELETE); |
|
260 | 260 | |
261 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
262 | - return true; |
|
263 | - } |
|
261 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
262 | + return true; |
|
263 | + } |
|
264 | 264 | |
265 | - return false; |
|
266 | - } |
|
265 | + return false; |
|
266 | + } |
|
267 | 267 | |
268 | - /** |
|
269 | - * List user teams |
|
270 | - * |
|
271 | - * @link https://developer.github.com/v3/orgs/teams/#list-user-teams |
|
272 | - * @return array |
|
273 | - * @throws \Exception |
|
274 | - */ |
|
275 | - public function lisUserTeams(): array |
|
276 | - { |
|
277 | - return $this->getApi()->request($this->getApi()->sprintf('/user/teams')); |
|
278 | - } |
|
268 | + /** |
|
269 | + * List user teams |
|
270 | + * |
|
271 | + * @link https://developer.github.com/v3/orgs/teams/#list-user-teams |
|
272 | + * @return array |
|
273 | + * @throws \Exception |
|
274 | + */ |
|
275 | + public function lisUserTeams(): array |
|
276 | + { |
|
277 | + return $this->getApi()->request($this->getApi()->sprintf('/user/teams')); |
|
278 | + } |
|
279 | 279 | } |
280 | 280 | \ No newline at end of file |
@@ -12,66 +12,66 @@ |
||
12 | 12 | abstract class AbstractOrganizations |
13 | 13 | { |
14 | 14 | |
15 | - /** Properties */ |
|
16 | - protected $organizations; |
|
17 | - protected $api; |
|
15 | + /** Properties */ |
|
16 | + protected $organizations; |
|
17 | + protected $api; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Constructor |
|
21 | - * |
|
22 | - * @param Organizations $organizations |
|
23 | - */ |
|
24 | - public function __construct(Organizations $organizations) |
|
25 | - { |
|
26 | - $this->setOrganizations($organizations); |
|
27 | - $this->setApi($organizations->getApi()); |
|
28 | - } |
|
19 | + /** |
|
20 | + * Constructor |
|
21 | + * |
|
22 | + * @param Organizations $organizations |
|
23 | + */ |
|
24 | + public function __construct(Organizations $organizations) |
|
25 | + { |
|
26 | + $this->setOrganizations($organizations); |
|
27 | + $this->setApi($organizations->getApi()); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Get organizations |
|
32 | - * |
|
33 | - * @return Organizations |
|
34 | - */ |
|
35 | - public function getOrganizations(): Organizations |
|
36 | - { |
|
37 | - return $this->organizations; |
|
38 | - } |
|
30 | + /** |
|
31 | + * Get organizations |
|
32 | + * |
|
33 | + * @return Organizations |
|
34 | + */ |
|
35 | + public function getOrganizations(): Organizations |
|
36 | + { |
|
37 | + return $this->organizations; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Set organizations |
|
42 | - * |
|
43 | - * @param Organizations $organizations |
|
44 | - * |
|
45 | - * @return AbstractOrganizations |
|
46 | - */ |
|
47 | - public function setOrganizations(Organizations $organizations): AbstractOrganizations |
|
48 | - { |
|
49 | - $this->organizations = $organizations; |
|
40 | + /** |
|
41 | + * Set organizations |
|
42 | + * |
|
43 | + * @param Organizations $organizations |
|
44 | + * |
|
45 | + * @return AbstractOrganizations |
|
46 | + */ |
|
47 | + public function setOrganizations(Organizations $organizations): AbstractOrganizations |
|
48 | + { |
|
49 | + $this->organizations = $organizations; |
|
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 mixed $api |
|
68 | - * |
|
69 | - * @return AbstractOrganizations |
|
70 | - */ |
|
71 | - public function setApi(AbstractApi $api): AbstractOrganizations |
|
72 | - { |
|
73 | - $this->api = $api; |
|
64 | + /** |
|
65 | + * Set api |
|
66 | + * |
|
67 | + * @param mixed $api |
|
68 | + * |
|
69 | + * @return AbstractOrganizations |
|
70 | + */ |
|
71 | + public function setApi(AbstractApi $api): AbstractOrganizations |
|
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,130 +12,130 @@ |
||
12 | 12 | class Hooks extends AbstractOrganizations |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * List hooks |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/orgs/hooks/#list-hooks |
|
19 | - * |
|
20 | - * @param string $org |
|
21 | - * |
|
22 | - * @return array |
|
23 | - * @throws \Exception |
|
24 | - */ |
|
25 | - public function listHooks(string $org): array |
|
26 | - { |
|
27 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks', $org)); |
|
28 | - } |
|
15 | + /** |
|
16 | + * List hooks |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/orgs/hooks/#list-hooks |
|
19 | + * |
|
20 | + * @param string $org |
|
21 | + * |
|
22 | + * @return array |
|
23 | + * @throws \Exception |
|
24 | + */ |
|
25 | + public function listHooks(string $org): array |
|
26 | + { |
|
27 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks', $org)); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Get single hook |
|
32 | - * |
|
33 | - * @link https://developer.github.com/v3/orgs/hooks/#get-single-hook |
|
34 | - * |
|
35 | - * @param string $org |
|
36 | - * @param int $id |
|
37 | - * |
|
38 | - * @return array |
|
39 | - * @throws \Exception |
|
40 | - */ |
|
41 | - public function getSingleHook(string $org, int $id): array |
|
42 | - { |
|
43 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks/:id', $org, (string)$id)); |
|
44 | - } |
|
30 | + /** |
|
31 | + * Get single hook |
|
32 | + * |
|
33 | + * @link https://developer.github.com/v3/orgs/hooks/#get-single-hook |
|
34 | + * |
|
35 | + * @param string $org |
|
36 | + * @param int $id |
|
37 | + * |
|
38 | + * @return array |
|
39 | + * @throws \Exception |
|
40 | + */ |
|
41 | + public function getSingleHook(string $org, int $id): array |
|
42 | + { |
|
43 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks/:id', $org, (string)$id)); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Create a hook |
|
48 | - * |
|
49 | - * @link https://developer.github.com/v3/orgs/hooks/#create-a-hook |
|
50 | - * |
|
51 | - * @param string $org |
|
52 | - * @param string $name |
|
53 | - * @param string|array $config |
|
54 | - * @param array $events |
|
55 | - * @param bool $active |
|
56 | - * |
|
57 | - * @return array |
|
58 | - * @throws \Exception |
|
59 | - */ |
|
60 | - public function createHook(string $org, string $name, $config, array $events = [AbstractApi::EVENTS_PUSH], |
|
61 | - bool $active = false): array |
|
62 | - { |
|
63 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks', $org), Request::METHOD_POST, [ |
|
64 | - 'name' => $name, |
|
65 | - 'config' => $config, |
|
66 | - 'events' => $events, |
|
67 | - 'active' => $active |
|
68 | - ]); |
|
69 | - } |
|
46 | + /** |
|
47 | + * Create a hook |
|
48 | + * |
|
49 | + * @link https://developer.github.com/v3/orgs/hooks/#create-a-hook |
|
50 | + * |
|
51 | + * @param string $org |
|
52 | + * @param string $name |
|
53 | + * @param string|array $config |
|
54 | + * @param array $events |
|
55 | + * @param bool $active |
|
56 | + * |
|
57 | + * @return array |
|
58 | + * @throws \Exception |
|
59 | + */ |
|
60 | + public function createHook(string $org, string $name, $config, array $events = [AbstractApi::EVENTS_PUSH], |
|
61 | + bool $active = false): array |
|
62 | + { |
|
63 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks', $org), Request::METHOD_POST, [ |
|
64 | + 'name' => $name, |
|
65 | + 'config' => $config, |
|
66 | + 'events' => $events, |
|
67 | + 'active' => $active |
|
68 | + ]); |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * Edit a hook |
|
73 | - * |
|
74 | - * @link https://developer.github.com/v3/orgs/hooks/#edit-a-hook |
|
75 | - * |
|
76 | - * @param string $org |
|
77 | - * @param int $id |
|
78 | - * @param string|array $config |
|
79 | - * @param array $events |
|
80 | - * @param bool $active |
|
81 | - * |
|
82 | - * @return array |
|
83 | - * @throws \Exception |
|
84 | - */ |
|
85 | - public function editHook(string $org, int $id, $config, array $events = [AbstractApi::EVENTS_PUSH], |
|
86 | - bool $active = false): array |
|
87 | - { |
|
88 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks/:id', $org, (string)$id), |
|
89 | - Request::METHOD_PATCH, [ |
|
90 | - 'config' => $config, |
|
91 | - 'events' => $events, |
|
92 | - 'active' => $active |
|
93 | - ]); |
|
94 | - } |
|
71 | + /** |
|
72 | + * Edit a hook |
|
73 | + * |
|
74 | + * @link https://developer.github.com/v3/orgs/hooks/#edit-a-hook |
|
75 | + * |
|
76 | + * @param string $org |
|
77 | + * @param int $id |
|
78 | + * @param string|array $config |
|
79 | + * @param array $events |
|
80 | + * @param bool $active |
|
81 | + * |
|
82 | + * @return array |
|
83 | + * @throws \Exception |
|
84 | + */ |
|
85 | + public function editHook(string $org, int $id, $config, array $events = [AbstractApi::EVENTS_PUSH], |
|
86 | + bool $active = false): array |
|
87 | + { |
|
88 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks/:id', $org, (string)$id), |
|
89 | + Request::METHOD_PATCH, [ |
|
90 | + 'config' => $config, |
|
91 | + 'events' => $events, |
|
92 | + 'active' => $active |
|
93 | + ]); |
|
94 | + } |
|
95 | 95 | |
96 | - /** |
|
97 | - * Ping a hook |
|
98 | - * |
|
99 | - * @link https://developer.github.com/v3/orgs/hooks/#ping-a-hook |
|
100 | - * |
|
101 | - * @param string $org |
|
102 | - * @param int $id |
|
103 | - * |
|
104 | - * @return bool |
|
105 | - * @throws \Exception |
|
106 | - */ |
|
107 | - public function pingHook(string $org, int $id): bool |
|
108 | - { |
|
109 | - $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks/:id/pings', $org, (string)$id), |
|
110 | - Request::METHOD_POST); |
|
96 | + /** |
|
97 | + * Ping a hook |
|
98 | + * |
|
99 | + * @link https://developer.github.com/v3/orgs/hooks/#ping-a-hook |
|
100 | + * |
|
101 | + * @param string $org |
|
102 | + * @param int $id |
|
103 | + * |
|
104 | + * @return bool |
|
105 | + * @throws \Exception |
|
106 | + */ |
|
107 | + public function pingHook(string $org, int $id): bool |
|
108 | + { |
|
109 | + $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks/:id/pings', $org, (string)$id), |
|
110 | + Request::METHOD_POST); |
|
111 | 111 | |
112 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
113 | - return true; |
|
114 | - } |
|
112 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
113 | + return true; |
|
114 | + } |
|
115 | 115 | |
116 | - return false; |
|
117 | - } |
|
116 | + return false; |
|
117 | + } |
|
118 | 118 | |
119 | - /** |
|
120 | - * Delete a hook |
|
121 | - * |
|
122 | - * @link https://developer.github.com/v3/orgs/hooks/#delete-a-hook |
|
123 | - * |
|
124 | - * @param string $org |
|
125 | - * @param int $id |
|
126 | - * |
|
127 | - * @return bool |
|
128 | - * @throws \Exception |
|
129 | - */ |
|
130 | - public function deleteHook(string $org, int $id): bool |
|
131 | - { |
|
132 | - $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks/:id', $org, (string)$id), |
|
133 | - Request::METHOD_DELETE); |
|
119 | + /** |
|
120 | + * Delete a hook |
|
121 | + * |
|
122 | + * @link https://developer.github.com/v3/orgs/hooks/#delete-a-hook |
|
123 | + * |
|
124 | + * @param string $org |
|
125 | + * @param int $id |
|
126 | + * |
|
127 | + * @return bool |
|
128 | + * @throws \Exception |
|
129 | + */ |
|
130 | + public function deleteHook(string $org, int $id): bool |
|
131 | + { |
|
132 | + $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks/:id', $org, (string)$id), |
|
133 | + Request::METHOD_DELETE); |
|
134 | 134 | |
135 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
136 | - return true; |
|
137 | - } |
|
135 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
136 | + return true; |
|
137 | + } |
|
138 | 138 | |
139 | - return false; |
|
140 | - } |
|
139 | + return false; |
|
140 | + } |
|
141 | 141 | } |
142 | 142 | \ No newline at end of file |
@@ -12,93 +12,93 @@ |
||
12 | 12 | class Comments extends AbstractGists |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * List comments on a gist |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/gists/comments/#list-comments-on-a-gist |
|
19 | - * |
|
20 | - * @param int $gistId |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function listComments(int $gistId): array |
|
25 | - { |
|
26 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments', (string)$gistId)); |
|
27 | - } |
|
15 | + /** |
|
16 | + * List comments on a gist |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/gists/comments/#list-comments-on-a-gist |
|
19 | + * |
|
20 | + * @param int $gistId |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function listComments(int $gistId): array |
|
25 | + { |
|
26 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments', (string)$gistId)); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Get a single comment |
|
31 | - * |
|
32 | - * @link https://developer.github.com/v3/gists/comments/#get-a-single-comment |
|
33 | - * |
|
34 | - * @param int $gistId |
|
35 | - * @param int $id |
|
36 | - * |
|
37 | - * @return array |
|
38 | - */ |
|
39 | - public function getSingleComment(int $gistId, int $id): array |
|
40 | - { |
|
41 | - return $this->getApi()->request($this->getApi() |
|
42 | - ->sprintf('/gists/:gist_id/comments/:id', (string)$gistId, (string)$id)); |
|
43 | - } |
|
29 | + /** |
|
30 | + * Get a single comment |
|
31 | + * |
|
32 | + * @link https://developer.github.com/v3/gists/comments/#get-a-single-comment |
|
33 | + * |
|
34 | + * @param int $gistId |
|
35 | + * @param int $id |
|
36 | + * |
|
37 | + * @return array |
|
38 | + */ |
|
39 | + public function getSingleComment(int $gistId, int $id): array |
|
40 | + { |
|
41 | + return $this->getApi()->request($this->getApi() |
|
42 | + ->sprintf('/gists/:gist_id/comments/:id', (string)$gistId, (string)$id)); |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Create a comment |
|
47 | - * |
|
48 | - * @link https://developer.github.com/v3/gists/comments/#create-a-comment |
|
49 | - * |
|
50 | - * @param int $gistId |
|
51 | - * @param string $body |
|
52 | - * |
|
53 | - * @return array |
|
54 | - */ |
|
55 | - public function createComment(int $gistId, string $body): array |
|
56 | - { |
|
57 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments', (string)$gistId), |
|
58 | - Request::METHOD_POST, [ |
|
59 | - 'body' => $body |
|
60 | - ]); |
|
61 | - } |
|
45 | + /** |
|
46 | + * Create a comment |
|
47 | + * |
|
48 | + * @link https://developer.github.com/v3/gists/comments/#create-a-comment |
|
49 | + * |
|
50 | + * @param int $gistId |
|
51 | + * @param string $body |
|
52 | + * |
|
53 | + * @return array |
|
54 | + */ |
|
55 | + public function createComment(int $gistId, string $body): array |
|
56 | + { |
|
57 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments', (string)$gistId), |
|
58 | + Request::METHOD_POST, [ |
|
59 | + 'body' => $body |
|
60 | + ]); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Edit a comment |
|
65 | - * |
|
66 | - * @link https://developer.github.com/v3/gists/comments/#edit-a-comment |
|
67 | - * |
|
68 | - * @param int $gistId |
|
69 | - * @param int $id |
|
70 | - * @param string $body |
|
71 | - * |
|
72 | - * @return array |
|
73 | - */ |
|
74 | - public function editComment(int $gistId, int $id, string $body): array |
|
75 | - { |
|
76 | - return $this->getApi()->request($this->getApi() |
|
77 | - ->sprintf('/gists/:gist_id/comments/:id', (string)$gistId, (string)$id), |
|
78 | - Request::METHOD_PATCH, [ |
|
79 | - 'body' => $body |
|
80 | - ]); |
|
81 | - } |
|
63 | + /** |
|
64 | + * Edit a comment |
|
65 | + * |
|
66 | + * @link https://developer.github.com/v3/gists/comments/#edit-a-comment |
|
67 | + * |
|
68 | + * @param int $gistId |
|
69 | + * @param int $id |
|
70 | + * @param string $body |
|
71 | + * |
|
72 | + * @return array |
|
73 | + */ |
|
74 | + public function editComment(int $gistId, int $id, string $body): array |
|
75 | + { |
|
76 | + return $this->getApi()->request($this->getApi() |
|
77 | + ->sprintf('/gists/:gist_id/comments/:id', (string)$gistId, (string)$id), |
|
78 | + Request::METHOD_PATCH, [ |
|
79 | + 'body' => $body |
|
80 | + ]); |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * Delete a comment |
|
85 | - * |
|
86 | - * @link https://developer.github.com/v3/gists/comments/#delete-a-comment |
|
87 | - * |
|
88 | - * @param int $gistId |
|
89 | - * @param int $id |
|
90 | - * |
|
91 | - * @return bool |
|
92 | - */ |
|
93 | - public function deleteComment(int $gistId, int $id): bool |
|
94 | - { |
|
95 | - $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments/:id', (string)$gistId, (string)$id), |
|
96 | - Request::METHOD_DELETE); |
|
83 | + /** |
|
84 | + * Delete a comment |
|
85 | + * |
|
86 | + * @link https://developer.github.com/v3/gists/comments/#delete-a-comment |
|
87 | + * |
|
88 | + * @param int $gistId |
|
89 | + * @param int $id |
|
90 | + * |
|
91 | + * @return bool |
|
92 | + */ |
|
93 | + public function deleteComment(int $gistId, int $id): bool |
|
94 | + { |
|
95 | + $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments/:id', (string)$gistId, (string)$id), |
|
96 | + Request::METHOD_DELETE); |
|
97 | 97 | |
98 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
99 | - return true; |
|
100 | - } |
|
98 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
99 | + return true; |
|
100 | + } |
|
101 | 101 | |
102 | - return false; |
|
103 | - } |
|
102 | + return false; |
|
103 | + } |
|
104 | 104 | } |
105 | 105 | \ No newline at end of file |
@@ -12,66 +12,66 @@ |
||
12 | 12 | abstract class AbstractGists |
13 | 13 | { |
14 | 14 | |
15 | - /** Properties */ |
|
16 | - protected $gists; |
|
17 | - protected $api; |
|
15 | + /** Properties */ |
|
16 | + protected $gists; |
|
17 | + protected $api; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Constructor |
|
21 | - * |
|
22 | - * @param Gists $gists |
|
23 | - */ |
|
24 | - public function __construct(Gists $gists) |
|
25 | - { |
|
26 | - $this->setGists($gists); |
|
27 | - $this->setApi($gists->getApi()); |
|
28 | - } |
|
19 | + /** |
|
20 | + * Constructor |
|
21 | + * |
|
22 | + * @param Gists $gists |
|
23 | + */ |
|
24 | + public function __construct(Gists $gists) |
|
25 | + { |
|
26 | + $this->setGists($gists); |
|
27 | + $this->setApi($gists->getApi()); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Get gists |
|
32 | - * |
|
33 | - * @return Gists |
|
34 | - */ |
|
35 | - public function getGists(): Gists |
|
36 | - { |
|
37 | - return $this->gists; |
|
38 | - } |
|
30 | + /** |
|
31 | + * Get gists |
|
32 | + * |
|
33 | + * @return Gists |
|
34 | + */ |
|
35 | + public function getGists(): Gists |
|
36 | + { |
|
37 | + return $this->gists; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Set gists |
|
42 | - * |
|
43 | - * @param Gists $gists |
|
44 | - * |
|
45 | - * @return AbstractGists |
|
46 | - */ |
|
47 | - public function setGists(Gists $gists): AbstractGists |
|
48 | - { |
|
49 | - $this->gists = $gists; |
|
40 | + /** |
|
41 | + * Set gists |
|
42 | + * |
|
43 | + * @param Gists $gists |
|
44 | + * |
|
45 | + * @return AbstractGists |
|
46 | + */ |
|
47 | + public function setGists(Gists $gists): AbstractGists |
|
48 | + { |
|
49 | + $this->gists = $gists; |
|
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 AbstractGists |
|
70 | - */ |
|
71 | - public function setApi(AbstractApi $api): AbstractGists |
|
72 | - { |
|
73 | - $this->api = $api; |
|
64 | + /** |
|
65 | + * Set api |
|
66 | + * |
|
67 | + * @param AbstractApi $api |
|
68 | + * |
|
69 | + * @return AbstractGists |
|
70 | + */ |
|
71 | + public function setApi(AbstractApi $api): AbstractGists |
|
72 | + { |
|
73 | + $this->api = $api; |
|
74 | 74 | |
75 | - return $this; |
|
76 | - } |
|
75 | + return $this; |
|
76 | + } |
|
77 | 77 | } |
78 | 78 | \ No newline at end of file |
@@ -13,309 +13,309 @@ |
||
13 | 13 | class Repositories extends AbstractReceiver |
14 | 14 | { |
15 | 15 | |
16 | - /** Available sub-Receiver */ |
|
17 | - const COLLABORATORS = 'Collaborators'; |
|
18 | - const COMMENTS = 'Comments'; |
|
19 | - const COMMITS = 'Commits'; |
|
20 | - const CONTENTS = 'Contents'; |
|
21 | - const DEPLOY_KEYS = 'DeployKeys'; |
|
22 | - const DEPLOYMENTS = 'Deployments'; |
|
23 | - const FORKS = 'Forks'; |
|
24 | - const HOOKS = 'Hooks'; |
|
25 | - const MERGING = 'Merging'; |
|
26 | - const PAGES = 'Pages'; |
|
27 | - const RELEASES = 'Releases'; |
|
28 | - const STATISTICS = 'Statistics'; |
|
29 | - const STATUSES = 'Statuses'; |
|
16 | + /** Available sub-Receiver */ |
|
17 | + const COLLABORATORS = 'Collaborators'; |
|
18 | + const COMMENTS = 'Comments'; |
|
19 | + const COMMITS = 'Commits'; |
|
20 | + const CONTENTS = 'Contents'; |
|
21 | + const DEPLOY_KEYS = 'DeployKeys'; |
|
22 | + const DEPLOYMENTS = 'Deployments'; |
|
23 | + const FORKS = 'Forks'; |
|
24 | + const HOOKS = 'Hooks'; |
|
25 | + const MERGING = 'Merging'; |
|
26 | + const PAGES = 'Pages'; |
|
27 | + const RELEASES = 'Releases'; |
|
28 | + const STATISTICS = 'Statistics'; |
|
29 | + const STATUSES = 'Statuses'; |
|
30 | 30 | |
31 | - /** |
|
32 | - * List repositories for the authenticated user. |
|
33 | - * |
|
34 | - * @link https://developer.github.com/v3/repos/#list-your-repositories |
|
35 | - * |
|
36 | - * @param string $type |
|
37 | - * @param string $sort |
|
38 | - * @param string $direction |
|
39 | - * |
|
40 | - * @return array |
|
41 | - */ |
|
42 | - public function listYourRepositories(string $type = AbstractApi::TYPE_ALL, |
|
43 | - string $sort = AbstractApi::SORT_FULL_NAME, |
|
44 | - string $direction = AbstractApi::DIRECTION_DESC): array |
|
45 | - { |
|
46 | - return $this->getApi()->request($this->getApi()->sprintf('/user/repos?:args', |
|
47 | - http_build_query(['type' => $type, 'sort' => $sort, 'direction' => $direction]))); |
|
48 | - } |
|
31 | + /** |
|
32 | + * List repositories for the authenticated user. |
|
33 | + * |
|
34 | + * @link https://developer.github.com/v3/repos/#list-your-repositories |
|
35 | + * |
|
36 | + * @param string $type |
|
37 | + * @param string $sort |
|
38 | + * @param string $direction |
|
39 | + * |
|
40 | + * @return array |
|
41 | + */ |
|
42 | + public function listYourRepositories(string $type = AbstractApi::TYPE_ALL, |
|
43 | + string $sort = AbstractApi::SORT_FULL_NAME, |
|
44 | + string $direction = AbstractApi::DIRECTION_DESC): array |
|
45 | + { |
|
46 | + return $this->getApi()->request($this->getApi()->sprintf('/user/repos?:args', |
|
47 | + http_build_query(['type' => $type, 'sort' => $sort, 'direction' => $direction]))); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * List public repositories for the specified user. |
|
52 | - * |
|
53 | - * @link https://developer.github.com/v3/repos/#list-user-repositories |
|
54 | - * |
|
55 | - * @param string $username |
|
56 | - * @param string $type |
|
57 | - * @param string $sort |
|
58 | - * @param string $direction |
|
59 | - * |
|
60 | - * @return array |
|
61 | - */ |
|
62 | - public function listUserRepositories(string $username, string $type = AbstractApi::TYPE_OWNER, |
|
63 | - string $sort = AbstractApi::SORT_FULL_NAME, |
|
64 | - string $direction = AbstractApi::DIRECTION_DESC): array |
|
65 | - { |
|
66 | - return $this->getApi()->request($this->getApi()->sprintf('/users/:username/repos?:args', $username, |
|
67 | - http_build_query(['type' => $type, 'sort' => $sort, 'direction' => $direction]))); |
|
68 | - } |
|
50 | + /** |
|
51 | + * List public repositories for the specified user. |
|
52 | + * |
|
53 | + * @link https://developer.github.com/v3/repos/#list-user-repositories |
|
54 | + * |
|
55 | + * @param string $username |
|
56 | + * @param string $type |
|
57 | + * @param string $sort |
|
58 | + * @param string $direction |
|
59 | + * |
|
60 | + * @return array |
|
61 | + */ |
|
62 | + public function listUserRepositories(string $username, string $type = AbstractApi::TYPE_OWNER, |
|
63 | + string $sort = AbstractApi::SORT_FULL_NAME, |
|
64 | + string $direction = AbstractApi::DIRECTION_DESC): array |
|
65 | + { |
|
66 | + return $this->getApi()->request($this->getApi()->sprintf('/users/:username/repos?:args', $username, |
|
67 | + http_build_query(['type' => $type, 'sort' => $sort, 'direction' => $direction]))); |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * List repositories for the specified org. |
|
72 | - * |
|
73 | - * @link https://developer.github.com/v3/repos/#list-organization-repositories |
|
74 | - * |
|
75 | - * @param string $organization |
|
76 | - * @param string $type |
|
77 | - * |
|
78 | - * @return array |
|
79 | - */ |
|
80 | - public function listOrganizationRepositories(string $organization, string $type = AbstractApi::TYPE_ALL): array |
|
81 | - { |
|
82 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/repos?:args', $organization, |
|
83 | - http_build_query(['type' => $type]))); |
|
84 | - } |
|
70 | + /** |
|
71 | + * List repositories for the specified org. |
|
72 | + * |
|
73 | + * @link https://developer.github.com/v3/repos/#list-organization-repositories |
|
74 | + * |
|
75 | + * @param string $organization |
|
76 | + * @param string $type |
|
77 | + * |
|
78 | + * @return array |
|
79 | + */ |
|
80 | + public function listOrganizationRepositories(string $organization, string $type = AbstractApi::TYPE_ALL): array |
|
81 | + { |
|
82 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/repos?:args', $organization, |
|
83 | + http_build_query(['type' => $type]))); |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * List all public repositories |
|
88 | - * |
|
89 | - * @link https://developer.github.com/v3/repos/#list-all-public-repositories |
|
90 | - * |
|
91 | - * @param string $since |
|
92 | - * |
|
93 | - * @return array |
|
94 | - */ |
|
95 | - public function listPublicRepositories(string $since = '1970-01-01'): array |
|
96 | - { |
|
97 | - return $this->getApi()->request($this->getApi() |
|
98 | - ->sprintf('/repositories?:arg', http_build_query(['since', $since]))); |
|
99 | - } |
|
86 | + /** |
|
87 | + * List all public repositories |
|
88 | + * |
|
89 | + * @link https://developer.github.com/v3/repos/#list-all-public-repositories |
|
90 | + * |
|
91 | + * @param string $since |
|
92 | + * |
|
93 | + * @return array |
|
94 | + */ |
|
95 | + public function listPublicRepositories(string $since = '1970-01-01'): array |
|
96 | + { |
|
97 | + return $this->getApi()->request($this->getApi() |
|
98 | + ->sprintf('/repositories?:arg', http_build_query(['since', $since]))); |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * Create a new repository for the authenticated user. |
|
103 | - * |
|
104 | - * @link https://developer.github.com/v3/repos/#create |
|
105 | - * |
|
106 | - * @param string $name |
|
107 | - * @param string $description |
|
108 | - * @param string $homepage |
|
109 | - * @param bool $private |
|
110 | - * @param bool $hasIssues |
|
111 | - * @param bool $hasWiki |
|
112 | - * @param bool $hasDownloads |
|
113 | - * @param int $teamId |
|
114 | - * @param bool $autoInit |
|
115 | - * @param string $gitignoreTemplate |
|
116 | - * @param string $licenseTemplate |
|
117 | - * |
|
118 | - * @return array |
|
119 | - */ |
|
120 | - public function createRepository(string $name, string $description = '', string $homepage = '', |
|
121 | - bool $private = false, bool $hasIssues = true, bool $hasWiki = true, |
|
122 | - bool $hasDownloads = true, int $teamId = 0, bool $autoInit = false, |
|
123 | - string $gitignoreTemplate = '', string $licenseTemplate = ''): array |
|
124 | - { |
|
125 | - return $this->getApi()->request(sprintf('/user/repos'), Request::METHOD_POST, [ |
|
126 | - 'name' => $name, |
|
127 | - 'description' => $description, |
|
128 | - 'homepage' => $homepage, |
|
129 | - 'private' => $private, |
|
130 | - 'has_issues' => $hasIssues, |
|
131 | - 'has_wiki' => $hasWiki, |
|
132 | - 'has_downloads' => $hasDownloads, |
|
133 | - 'team_id' => $teamId, |
|
134 | - 'auto_init' => $autoInit, |
|
135 | - 'gitignore_template' => $gitignoreTemplate, |
|
136 | - 'license_template' => $licenseTemplate |
|
137 | - ]); |
|
138 | - } |
|
101 | + /** |
|
102 | + * Create a new repository for the authenticated user. |
|
103 | + * |
|
104 | + * @link https://developer.github.com/v3/repos/#create |
|
105 | + * |
|
106 | + * @param string $name |
|
107 | + * @param string $description |
|
108 | + * @param string $homepage |
|
109 | + * @param bool $private |
|
110 | + * @param bool $hasIssues |
|
111 | + * @param bool $hasWiki |
|
112 | + * @param bool $hasDownloads |
|
113 | + * @param int $teamId |
|
114 | + * @param bool $autoInit |
|
115 | + * @param string $gitignoreTemplate |
|
116 | + * @param string $licenseTemplate |
|
117 | + * |
|
118 | + * @return array |
|
119 | + */ |
|
120 | + public function createRepository(string $name, string $description = '', string $homepage = '', |
|
121 | + bool $private = false, bool $hasIssues = true, bool $hasWiki = true, |
|
122 | + bool $hasDownloads = true, int $teamId = 0, bool $autoInit = false, |
|
123 | + string $gitignoreTemplate = '', string $licenseTemplate = ''): array |
|
124 | + { |
|
125 | + return $this->getApi()->request(sprintf('/user/repos'), Request::METHOD_POST, [ |
|
126 | + 'name' => $name, |
|
127 | + 'description' => $description, |
|
128 | + 'homepage' => $homepage, |
|
129 | + 'private' => $private, |
|
130 | + 'has_issues' => $hasIssues, |
|
131 | + 'has_wiki' => $hasWiki, |
|
132 | + 'has_downloads' => $hasDownloads, |
|
133 | + 'team_id' => $teamId, |
|
134 | + 'auto_init' => $autoInit, |
|
135 | + 'gitignore_template' => $gitignoreTemplate, |
|
136 | + 'license_template' => $licenseTemplate |
|
137 | + ]); |
|
138 | + } |
|
139 | 139 | |
140 | - /** |
|
141 | - * Create a new repository in this organization. The authenticated user must be a member of the specified |
|
142 | - * organization. |
|
143 | - * |
|
144 | - * @link https://developer.github.com/v3/repos/#create |
|
145 | - * |
|
146 | - * @param string $organization |
|
147 | - * @param string $name |
|
148 | - * @param string $description |
|
149 | - * @param string $homepage |
|
150 | - * @param bool $private |
|
151 | - * @param bool $hasIssues |
|
152 | - * @param bool $hasWiki |
|
153 | - * @param bool $hasDownloads |
|
154 | - * @param int $teamId |
|
155 | - * @param bool $autoInit |
|
156 | - * @param string $gitignoreTemplate |
|
157 | - * @param string $licenseTemplate |
|
158 | - * |
|
159 | - * @return array |
|
160 | - */ |
|
161 | - public function createOrganizationRepository(string $organization, string $name, string $description = '', |
|
162 | - string $homepage = '', bool $private = false, bool $hasIssues = true, |
|
163 | - bool $hasWiki = true, bool $hasDownloads = true, int $teamId = 0, |
|
164 | - bool $autoInit = false, string $gitignoreTemplate = '', |
|
165 | - string $licenseTemplate = ''): array |
|
166 | - { |
|
167 | - return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/repos', $organization), |
|
168 | - Request::METHOD_POST, [ |
|
169 | - 'name' => $name, |
|
170 | - 'description' => $description, |
|
171 | - 'homepage' => $homepage, |
|
172 | - 'private' => $private, |
|
173 | - 'has_issues' => $hasIssues, |
|
174 | - 'has_wiki' => $hasWiki, |
|
175 | - 'has_downloads' => $hasDownloads, |
|
176 | - 'team_id' => $teamId, |
|
177 | - 'auto_init' => $autoInit, |
|
178 | - 'gitignore_template' => $gitignoreTemplate, |
|
179 | - 'license_template' => $licenseTemplate |
|
180 | - ]); |
|
181 | - } |
|
140 | + /** |
|
141 | + * Create a new repository in this organization. The authenticated user must be a member of the specified |
|
142 | + * organization. |
|
143 | + * |
|
144 | + * @link https://developer.github.com/v3/repos/#create |
|
145 | + * |
|
146 | + * @param string $organization |
|
147 | + * @param string $name |
|
148 | + * @param string $description |
|
149 | + * @param string $homepage |
|
150 | + * @param bool $private |
|
151 | + * @param bool $hasIssues |
|
152 | + * @param bool $hasWiki |
|
153 | + * @param bool $hasDownloads |
|
154 | + * @param int $teamId |
|
155 | + * @param bool $autoInit |
|
156 | + * @param string $gitignoreTemplate |
|
157 | + * @param string $licenseTemplate |
|
158 | + * |
|
159 | + * @return array |
|
160 | + */ |
|
161 | + public function createOrganizationRepository(string $organization, string $name, string $description = '', |
|
162 | + string $homepage = '', bool $private = false, bool $hasIssues = true, |
|
163 | + bool $hasWiki = true, bool $hasDownloads = true, int $teamId = 0, |
|
164 | + bool $autoInit = false, string $gitignoreTemplate = '', |
|
165 | + string $licenseTemplate = ''): array |
|
166 | + { |
|
167 | + return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/repos', $organization), |
|
168 | + Request::METHOD_POST, [ |
|
169 | + 'name' => $name, |
|
170 | + 'description' => $description, |
|
171 | + 'homepage' => $homepage, |
|
172 | + 'private' => $private, |
|
173 | + 'has_issues' => $hasIssues, |
|
174 | + 'has_wiki' => $hasWiki, |
|
175 | + 'has_downloads' => $hasDownloads, |
|
176 | + 'team_id' => $teamId, |
|
177 | + 'auto_init' => $autoInit, |
|
178 | + 'gitignore_template' => $gitignoreTemplate, |
|
179 | + 'license_template' => $licenseTemplate |
|
180 | + ]); |
|
181 | + } |
|
182 | 182 | |
183 | - /** |
|
184 | - * Get |
|
185 | - * |
|
186 | - * @link https://developer.github.com/v3/repos/#get |
|
187 | - * @return array |
|
188 | - */ |
|
189 | - public function get(): array |
|
190 | - { |
|
191 | - return $this->getApi()->request($this->getApi() |
|
192 | - ->sprintf('/repos/:owner/:repo', $this->getOwner(), $this->getRepo())); |
|
193 | - } |
|
183 | + /** |
|
184 | + * Get |
|
185 | + * |
|
186 | + * @link https://developer.github.com/v3/repos/#get |
|
187 | + * @return array |
|
188 | + */ |
|
189 | + public function get(): array |
|
190 | + { |
|
191 | + return $this->getApi()->request($this->getApi() |
|
192 | + ->sprintf('/repos/:owner/:repo', $this->getOwner(), $this->getRepo())); |
|
193 | + } |
|
194 | 194 | |
195 | - /** |
|
196 | - * Edit |
|
197 | - * |
|
198 | - * @link https://developer.github.com/v3/repos/#edit |
|
199 | - * |
|
200 | - * @param string $name |
|
201 | - * @param string $description |
|
202 | - * @param string $homepage |
|
203 | - * @param bool $private |
|
204 | - * @param bool $hasIssues |
|
205 | - * @param bool $hasWiki |
|
206 | - * @param bool $hasDownloads |
|
207 | - * @param string $defaultBranch |
|
208 | - * |
|
209 | - * @return array |
|
210 | - */ |
|
211 | - public function edit(string $name, string $description = '', string $homepage = '', bool $private = false, |
|
212 | - bool $hasIssues = true, bool $hasWiki = true, bool $hasDownloads = true, |
|
213 | - string $defaultBranch = ''): array |
|
214 | - { |
|
215 | - return $this->getApi()->request($this->getApi() |
|
216 | - ->sprintf('/repos/:owner/:repo', $this->getOwner(), $this->getRepo()), |
|
217 | - Request::METHOD_PATCH, [ |
|
218 | - 'name' => $name, |
|
219 | - 'description' => $description, |
|
220 | - 'homepage' => $homepage, |
|
221 | - 'private' => $private, |
|
222 | - 'has_issues' => $hasIssues, |
|
223 | - 'has_wiki' => $hasWiki, |
|
224 | - 'has_downloads' => $hasDownloads, |
|
225 | - 'default_branch' => $defaultBranch |
|
226 | - ]); |
|
227 | - } |
|
195 | + /** |
|
196 | + * Edit |
|
197 | + * |
|
198 | + * @link https://developer.github.com/v3/repos/#edit |
|
199 | + * |
|
200 | + * @param string $name |
|
201 | + * @param string $description |
|
202 | + * @param string $homepage |
|
203 | + * @param bool $private |
|
204 | + * @param bool $hasIssues |
|
205 | + * @param bool $hasWiki |
|
206 | + * @param bool $hasDownloads |
|
207 | + * @param string $defaultBranch |
|
208 | + * |
|
209 | + * @return array |
|
210 | + */ |
|
211 | + public function edit(string $name, string $description = '', string $homepage = '', bool $private = false, |
|
212 | + bool $hasIssues = true, bool $hasWiki = true, bool $hasDownloads = true, |
|
213 | + string $defaultBranch = ''): array |
|
214 | + { |
|
215 | + return $this->getApi()->request($this->getApi() |
|
216 | + ->sprintf('/repos/:owner/:repo', $this->getOwner(), $this->getRepo()), |
|
217 | + Request::METHOD_PATCH, [ |
|
218 | + 'name' => $name, |
|
219 | + 'description' => $description, |
|
220 | + 'homepage' => $homepage, |
|
221 | + 'private' => $private, |
|
222 | + 'has_issues' => $hasIssues, |
|
223 | + 'has_wiki' => $hasWiki, |
|
224 | + 'has_downloads' => $hasDownloads, |
|
225 | + 'default_branch' => $defaultBranch |
|
226 | + ]); |
|
227 | + } |
|
228 | 228 | |
229 | - /** |
|
230 | - * List contributors |
|
231 | - * |
|
232 | - * @link https://developer.github.com/v3/repos/#list-contributors |
|
233 | - * |
|
234 | - * @param string $anon |
|
235 | - * |
|
236 | - * @return array |
|
237 | - */ |
|
238 | - public function listContributors(string $anon = '0'): array |
|
239 | - { |
|
240 | - return $this->getApi()->request($this->getApi() |
|
241 | - ->sprintf('/repos/:owner/:repo/contributors?:args', $this->getOwner(), |
|
242 | - $this->getRepo(), http_build_query(['anon' => $anon]))); |
|
243 | - } |
|
229 | + /** |
|
230 | + * List contributors |
|
231 | + * |
|
232 | + * @link https://developer.github.com/v3/repos/#list-contributors |
|
233 | + * |
|
234 | + * @param string $anon |
|
235 | + * |
|
236 | + * @return array |
|
237 | + */ |
|
238 | + public function listContributors(string $anon = '0'): array |
|
239 | + { |
|
240 | + return $this->getApi()->request($this->getApi() |
|
241 | + ->sprintf('/repos/:owner/:repo/contributors?:args', $this->getOwner(), |
|
242 | + $this->getRepo(), http_build_query(['anon' => $anon]))); |
|
243 | + } |
|
244 | 244 | |
245 | - /** |
|
246 | - * List languages |
|
247 | - * |
|
248 | - * @link https://developer.github.com/v3/repos/#list-languages |
|
249 | - * @return array |
|
250 | - */ |
|
251 | - public function listLanguages(): array |
|
252 | - { |
|
253 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/languages', $this->getOwner(), |
|
254 | - $this->getRepo())); |
|
255 | - } |
|
245 | + /** |
|
246 | + * List languages |
|
247 | + * |
|
248 | + * @link https://developer.github.com/v3/repos/#list-languages |
|
249 | + * @return array |
|
250 | + */ |
|
251 | + public function listLanguages(): array |
|
252 | + { |
|
253 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/languages', $this->getOwner(), |
|
254 | + $this->getRepo())); |
|
255 | + } |
|
256 | 256 | |
257 | - /** |
|
258 | - * List Teams |
|
259 | - * |
|
260 | - * @link https://developer.github.com/v3/repos/#list-teams |
|
261 | - * @return array |
|
262 | - */ |
|
263 | - public function listTeams(): array |
|
264 | - { |
|
265 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/teams', $this->getOwner(), |
|
266 | - $this->getRepo())); |
|
267 | - } |
|
257 | + /** |
|
258 | + * List Teams |
|
259 | + * |
|
260 | + * @link https://developer.github.com/v3/repos/#list-teams |
|
261 | + * @return array |
|
262 | + */ |
|
263 | + public function listTeams(): array |
|
264 | + { |
|
265 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/teams', $this->getOwner(), |
|
266 | + $this->getRepo())); |
|
267 | + } |
|
268 | 268 | |
269 | - /** |
|
270 | - * List Tags |
|
271 | - * |
|
272 | - * @link https://developer.github.com/v3/repos/#list-tags |
|
273 | - * @return array |
|
274 | - */ |
|
275 | - public function listTags(): array |
|
276 | - { |
|
277 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/tags', $this->getOwner(), |
|
278 | - $this->getRepo())); |
|
279 | - } |
|
269 | + /** |
|
270 | + * List Tags |
|
271 | + * |
|
272 | + * @link https://developer.github.com/v3/repos/#list-tags |
|
273 | + * @return array |
|
274 | + */ |
|
275 | + public function listTags(): array |
|
276 | + { |
|
277 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/tags', $this->getOwner(), |
|
278 | + $this->getRepo())); |
|
279 | + } |
|
280 | 280 | |
281 | - /** |
|
282 | - * List Branches |
|
283 | - * |
|
284 | - * @link https://developer.github.com/v3/repos/#list-branches |
|
285 | - * @return array |
|
286 | - */ |
|
287 | - public function listBranches(): array |
|
288 | - { |
|
289 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/branches', $this->getOwner(), |
|
290 | - $this->getRepo())); |
|
291 | - } |
|
281 | + /** |
|
282 | + * List Branches |
|
283 | + * |
|
284 | + * @link https://developer.github.com/v3/repos/#list-branches |
|
285 | + * @return array |
|
286 | + */ |
|
287 | + public function listBranches(): array |
|
288 | + { |
|
289 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/branches', $this->getOwner(), |
|
290 | + $this->getRepo())); |
|
291 | + } |
|
292 | 292 | |
293 | - /** |
|
294 | - * Get Branch |
|
295 | - * |
|
296 | - * @link https://developer.github.com/v3/repos/#get-branch |
|
297 | - * |
|
298 | - * @param string $branch |
|
299 | - * |
|
300 | - * @return array |
|
301 | - */ |
|
302 | - public function getBranch(string $branch): array |
|
303 | - { |
|
304 | - return $this->getApi()->request($this->getApi() |
|
305 | - ->sprintf('/repos/:owner/:repo/branches/:branch', $this->getOwner(), |
|
306 | - $this->getRepo(), $branch)); |
|
307 | - } |
|
293 | + /** |
|
294 | + * Get Branch |
|
295 | + * |
|
296 | + * @link https://developer.github.com/v3/repos/#get-branch |
|
297 | + * |
|
298 | + * @param string $branch |
|
299 | + * |
|
300 | + * @return array |
|
301 | + */ |
|
302 | + public function getBranch(string $branch): array |
|
303 | + { |
|
304 | + return $this->getApi()->request($this->getApi() |
|
305 | + ->sprintf('/repos/:owner/:repo/branches/:branch', $this->getOwner(), |
|
306 | + $this->getRepo(), $branch)); |
|
307 | + } |
|
308 | 308 | |
309 | - /** |
|
310 | - * Delete a Repository |
|
311 | - * |
|
312 | - * @link https://developer.github.com/v3/repos/#delete-a-repository |
|
313 | - * @return array |
|
314 | - */ |
|
315 | - public function deleteRepository(): array |
|
316 | - { |
|
317 | - return $this->getApi()->request($this->getApi() |
|
318 | - ->sprintf('/repos/:owner/:repo', $this->getOwner(), $this->getRepo()), |
|
319 | - Request::METHOD_DELETE); |
|
320 | - } |
|
309 | + /** |
|
310 | + * Delete a Repository |
|
311 | + * |
|
312 | + * @link https://developer.github.com/v3/repos/#delete-a-repository |
|
313 | + * @return array |
|
314 | + */ |
|
315 | + public function deleteRepository(): array |
|
316 | + { |
|
317 | + return $this->getApi()->request($this->getApi() |
|
318 | + ->sprintf('/repos/:owner/:repo', $this->getOwner(), $this->getRepo()), |
|
319 | + Request::METHOD_DELETE); |
|
320 | + } |
|
321 | 321 | } |
322 | 322 | \ No newline at end of file |