@@ -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,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 |
@@ -13,47 +13,47 @@ |
||
13 | 13 | class Commits extends AbstractGitData |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * Get a Commit |
|
18 | - * |
|
19 | - * @link https://developer.github.com/v3/git/commits/#get-a-commit |
|
20 | - * |
|
21 | - * @param string $sha |
|
22 | - * |
|
23 | - * @return array |
|
24 | - */ |
|
25 | - public function get(string $sha): array |
|
26 | - { |
|
27 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/commits/:sha', |
|
28 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
29 | - } |
|
16 | + /** |
|
17 | + * Get a Commit |
|
18 | + * |
|
19 | + * @link https://developer.github.com/v3/git/commits/#get-a-commit |
|
20 | + * |
|
21 | + * @param string $sha |
|
22 | + * |
|
23 | + * @return array |
|
24 | + */ |
|
25 | + public function get(string $sha): array |
|
26 | + { |
|
27 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/commits/:sha', |
|
28 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Create a Commit |
|
33 | - * |
|
34 | - * @link https://developer.github.com/v3/git/commits/#create-a-commit |
|
35 | - * |
|
36 | - * @param string $message |
|
37 | - * @param string $tree |
|
38 | - * @param array|string $parents |
|
39 | - * @param string $name |
|
40 | - * @param string $email |
|
41 | - * @param string $date |
|
42 | - * |
|
43 | - * @return array |
|
44 | - * @throws \Exception |
|
45 | - */ |
|
46 | - public function create(string $message, string $tree, $parents, string $name = null, string $email = null, |
|
47 | - string $date = 'now'): array |
|
48 | - { |
|
49 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/commits', |
|
50 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
51 | - 'message' => $message, |
|
52 | - 'tree' => $tree, |
|
53 | - 'parents' => $parents, |
|
54 | - 'name' => $name, |
|
55 | - 'email' => $email, |
|
56 | - 'date' => (new DateTime($date))->format(DateTime::ATOM) |
|
57 | - ]); |
|
58 | - } |
|
31 | + /** |
|
32 | + * Create a Commit |
|
33 | + * |
|
34 | + * @link https://developer.github.com/v3/git/commits/#create-a-commit |
|
35 | + * |
|
36 | + * @param string $message |
|
37 | + * @param string $tree |
|
38 | + * @param array|string $parents |
|
39 | + * @param string $name |
|
40 | + * @param string $email |
|
41 | + * @param string $date |
|
42 | + * |
|
43 | + * @return array |
|
44 | + * @throws \Exception |
|
45 | + */ |
|
46 | + public function create(string $message, string $tree, $parents, string $name = null, string $email = null, |
|
47 | + string $date = 'now'): array |
|
48 | + { |
|
49 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/commits', |
|
50 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
51 | + 'message' => $message, |
|
52 | + 'tree' => $tree, |
|
53 | + 'parents' => $parents, |
|
54 | + 'name' => $name, |
|
55 | + 'email' => $email, |
|
56 | + 'date' => (new DateTime($date))->format(DateTime::ATOM) |
|
57 | + ]); |
|
58 | + } |
|
59 | 59 | } |
60 | 60 | \ No newline at end of file |
@@ -12,46 +12,46 @@ |
||
12 | 12 | class Tags extends AbstractGitData |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Get a Tag |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/git/tags/#get-a-tag |
|
19 | - * |
|
20 | - * @param string $sha |
|
21 | - * |
|
22 | - * @return array |
|
23 | - * @throws \Exception |
|
24 | - */ |
|
25 | - public function get(string $sha): array |
|
26 | - { |
|
27 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/tags/:sha', |
|
28 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
29 | - } |
|
15 | + /** |
|
16 | + * Get a Tag |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/git/tags/#get-a-tag |
|
19 | + * |
|
20 | + * @param string $sha |
|
21 | + * |
|
22 | + * @return array |
|
23 | + * @throws \Exception |
|
24 | + */ |
|
25 | + public function get(string $sha): array |
|
26 | + { |
|
27 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/tags/:sha', |
|
28 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Create a Tag Object |
|
33 | - * |
|
34 | - * @link https://developer.github.com/v3/git/tags/#create-a-tag-object |
|
35 | - * |
|
36 | - * @param string $tag |
|
37 | - * @param string $message |
|
38 | - * @param string $object |
|
39 | - * @param string $type |
|
40 | - * @param array $tagger |
|
41 | - * |
|
42 | - * @return array |
|
43 | - * @throws \Exception |
|
44 | - */ |
|
45 | - public function create(string $tag, string $message, string $object, string $type, array $tagger = []): array |
|
46 | - { |
|
47 | - return $this->getApi()->request($this->getApi() |
|
48 | - ->sprintf('/repos/:owner/:repo/git/tags', $this->getGitData()->getOwner(), |
|
49 | - $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
50 | - 'tag' => $tag, |
|
51 | - 'message' => $message, |
|
52 | - 'object' => $object, |
|
53 | - 'type' => $type, |
|
54 | - 'tagger' => $tagger |
|
55 | - ]); |
|
56 | - } |
|
31 | + /** |
|
32 | + * Create a Tag Object |
|
33 | + * |
|
34 | + * @link https://developer.github.com/v3/git/tags/#create-a-tag-object |
|
35 | + * |
|
36 | + * @param string $tag |
|
37 | + * @param string $message |
|
38 | + * @param string $object |
|
39 | + * @param string $type |
|
40 | + * @param array $tagger |
|
41 | + * |
|
42 | + * @return array |
|
43 | + * @throws \Exception |
|
44 | + */ |
|
45 | + public function create(string $tag, string $message, string $object, string $type, array $tagger = []): array |
|
46 | + { |
|
47 | + return $this->getApi()->request($this->getApi() |
|
48 | + ->sprintf('/repos/:owner/:repo/git/tags', $this->getGitData()->getOwner(), |
|
49 | + $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
50 | + 'tag' => $tag, |
|
51 | + 'message' => $message, |
|
52 | + 'object' => $object, |
|
53 | + 'type' => $type, |
|
54 | + 'tagger' => $tagger |
|
55 | + ]); |
|
56 | + } |
|
57 | 57 | } |
58 | 58 | \ No newline at end of file |
@@ -12,98 +12,98 @@ |
||
12 | 12 | class References extends AbstractGitData |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Get a Reference |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/git/refs/#get-a-reference |
|
19 | - * |
|
20 | - * @param string $branch |
|
21 | - * |
|
22 | - * @return array |
|
23 | - * @throws \Exception |
|
24 | - */ |
|
25 | - public function get(string $branch): array |
|
26 | - { |
|
27 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/refs/heads/:branch', |
|
28 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $branch)); |
|
29 | - } |
|
15 | + /** |
|
16 | + * Get a Reference |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/git/refs/#get-a-reference |
|
19 | + * |
|
20 | + * @param string $branch |
|
21 | + * |
|
22 | + * @return array |
|
23 | + * @throws \Exception |
|
24 | + */ |
|
25 | + public function get(string $branch): array |
|
26 | + { |
|
27 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/refs/heads/:branch', |
|
28 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $branch)); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Get all References |
|
33 | - * |
|
34 | - * @link https://developer.github.com/v3/git/refs/#get-all-references |
|
35 | - * @return array |
|
36 | - * @throws \Exception |
|
37 | - */ |
|
38 | - public function getAll(): array |
|
39 | - { |
|
40 | - return $this->getApi()->request($this->getApi() |
|
41 | - ->sprintf('/repos/:owner/:repo/git/refs', $this->getGitData()->getOwner(), |
|
42 | - $this->getGitData()->getRepo())); |
|
43 | - } |
|
31 | + /** |
|
32 | + * Get all References |
|
33 | + * |
|
34 | + * @link https://developer.github.com/v3/git/refs/#get-all-references |
|
35 | + * @return array |
|
36 | + * @throws \Exception |
|
37 | + */ |
|
38 | + public function getAll(): array |
|
39 | + { |
|
40 | + return $this->getApi()->request($this->getApi() |
|
41 | + ->sprintf('/repos/:owner/:repo/git/refs', $this->getGitData()->getOwner(), |
|
42 | + $this->getGitData()->getRepo())); |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Create a Reference |
|
47 | - * |
|
48 | - * @link https://developer.github.com/v3/git/refs/#create-a-reference |
|
49 | - * |
|
50 | - * @param string $ref |
|
51 | - * @param string $sha |
|
52 | - * |
|
53 | - * @return array |
|
54 | - * @throws \Exception |
|
55 | - */ |
|
56 | - public function create(string $ref, string $sha): array |
|
57 | - { |
|
58 | - return $this->getApi()->request($this->getApi() |
|
59 | - ->sprintf('/repos/:owner/:repo/git/refs', $this->getGitData()->getOwner(), |
|
60 | - $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
61 | - 'ref' => $ref, |
|
62 | - 'sha' => $sha |
|
63 | - ]); |
|
64 | - } |
|
45 | + /** |
|
46 | + * Create a Reference |
|
47 | + * |
|
48 | + * @link https://developer.github.com/v3/git/refs/#create-a-reference |
|
49 | + * |
|
50 | + * @param string $ref |
|
51 | + * @param string $sha |
|
52 | + * |
|
53 | + * @return array |
|
54 | + * @throws \Exception |
|
55 | + */ |
|
56 | + public function create(string $ref, string $sha): array |
|
57 | + { |
|
58 | + return $this->getApi()->request($this->getApi() |
|
59 | + ->sprintf('/repos/:owner/:repo/git/refs', $this->getGitData()->getOwner(), |
|
60 | + $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
61 | + 'ref' => $ref, |
|
62 | + 'sha' => $sha |
|
63 | + ]); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * Update a Reference |
|
68 | - * |
|
69 | - * @link https://developer.github.com/v3/git/refs/#update-a-reference |
|
70 | - * |
|
71 | - * @param string $ref |
|
72 | - * @param string $sha |
|
73 | - * @param bool $force |
|
74 | - * |
|
75 | - * @return array |
|
76 | - * @throws \Exception |
|
77 | - */ |
|
78 | - public function update(string $ref, string $sha, bool $force = false): array |
|
79 | - { |
|
80 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/refs/:ref', |
|
81 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $ref), Request::METHOD_POST, [ |
|
82 | - 'sha' => $sha, |
|
83 | - 'force' => $force |
|
84 | - ]); |
|
85 | - } |
|
66 | + /** |
|
67 | + * Update a Reference |
|
68 | + * |
|
69 | + * @link https://developer.github.com/v3/git/refs/#update-a-reference |
|
70 | + * |
|
71 | + * @param string $ref |
|
72 | + * @param string $sha |
|
73 | + * @param bool $force |
|
74 | + * |
|
75 | + * @return array |
|
76 | + * @throws \Exception |
|
77 | + */ |
|
78 | + public function update(string $ref, string $sha, bool $force = false): array |
|
79 | + { |
|
80 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/refs/:ref', |
|
81 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $ref), Request::METHOD_POST, [ |
|
82 | + 'sha' => $sha, |
|
83 | + 'force' => $force |
|
84 | + ]); |
|
85 | + } |
|
86 | 86 | |
87 | - /** |
|
88 | - * Delete a Reference |
|
89 | - * |
|
90 | - * @link https://developer.github.com/v3/git/refs/#delete-a-reference |
|
91 | - * |
|
92 | - * @param string $ref |
|
93 | - * |
|
94 | - * @return bool |
|
95 | - * @throws \Exception |
|
96 | - */ |
|
97 | - public function delete(string $ref): bool |
|
98 | - { |
|
99 | - $this->getApi()->request($this->getApi() |
|
100 | - ->sprintf('/repos/:owner/:repo/git/refs/:ref', $this->getGitData()->getOwner(), |
|
101 | - $this->getGitData()->getRepo(), $ref), Request::METHOD_DELETE); |
|
87 | + /** |
|
88 | + * Delete a Reference |
|
89 | + * |
|
90 | + * @link https://developer.github.com/v3/git/refs/#delete-a-reference |
|
91 | + * |
|
92 | + * @param string $ref |
|
93 | + * |
|
94 | + * @return bool |
|
95 | + * @throws \Exception |
|
96 | + */ |
|
97 | + public function delete(string $ref): bool |
|
98 | + { |
|
99 | + $this->getApi()->request($this->getApi() |
|
100 | + ->sprintf('/repos/:owner/:repo/git/refs/:ref', $this->getGitData()->getOwner(), |
|
101 | + $this->getGitData()->getRepo(), $ref), Request::METHOD_DELETE); |
|
102 | 102 | |
103 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
104 | - return true; |
|
105 | - } |
|
103 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
104 | + return true; |
|
105 | + } |
|
106 | 106 | |
107 | - return false; |
|
108 | - } |
|
107 | + return false; |
|
108 | + } |
|
109 | 109 | } |
110 | 110 | \ No newline at end of file |
@@ -12,56 +12,56 @@ |
||
12 | 12 | class Trees extends AbstractGitData |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Get a Tree |
|
17 | - * |
|
18 | - * @link https://developer.github.com/v3/git/trees/#get-a-tree |
|
19 | - * |
|
20 | - * @param string $sha |
|
21 | - * |
|
22 | - * @return array |
|
23 | - * @throws \Exception |
|
24 | - */ |
|
25 | - public function get(string $sha): array |
|
26 | - { |
|
27 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/trees/:sha', |
|
28 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
29 | - } |
|
15 | + /** |
|
16 | + * Get a Tree |
|
17 | + * |
|
18 | + * @link https://developer.github.com/v3/git/trees/#get-a-tree |
|
19 | + * |
|
20 | + * @param string $sha |
|
21 | + * |
|
22 | + * @return array |
|
23 | + * @throws \Exception |
|
24 | + */ |
|
25 | + public function get(string $sha): array |
|
26 | + { |
|
27 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/trees/:sha', |
|
28 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Get a Tree Recursively |
|
33 | - * |
|
34 | - * @link https://developer.github.com/v3/git/trees/#get-a-tree-recursively |
|
35 | - * |
|
36 | - * @param string $sha |
|
37 | - * |
|
38 | - * @return array |
|
39 | - * @throws \Exception |
|
40 | - */ |
|
41 | - public function getRecursively(string $sha): array |
|
42 | - { |
|
43 | - return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/trees/:sha?recursive=1', |
|
44 | - $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
45 | - } |
|
31 | + /** |
|
32 | + * Get a Tree Recursively |
|
33 | + * |
|
34 | + * @link https://developer.github.com/v3/git/trees/#get-a-tree-recursively |
|
35 | + * |
|
36 | + * @param string $sha |
|
37 | + * |
|
38 | + * @return array |
|
39 | + * @throws \Exception |
|
40 | + */ |
|
41 | + public function getRecursively(string $sha): array |
|
42 | + { |
|
43 | + return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/git/trees/:sha?recursive=1', |
|
44 | + $this->getGitData()->getOwner(), $this->getGitData()->getRepo(), $sha)); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Create a Tree |
|
49 | - * |
|
50 | - * @link https://developer.github.com/v3/git/trees/#create-a-tree |
|
51 | - * |
|
52 | - * @param array $tree |
|
53 | - * @param string $base_tree |
|
54 | - * |
|
55 | - * @return array |
|
56 | - * @throws \Exception |
|
57 | - */ |
|
58 | - public function create(array $tree, string $base_tree): array |
|
59 | - { |
|
60 | - return $this->getApi()->request($this->getApi() |
|
61 | - ->sprintf('/repos/:owner/:repo/git/trees', $this->getGitData()->getOwner(), |
|
62 | - $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
63 | - 'tree' => $tree, |
|
64 | - 'base_tree' => $base_tree |
|
65 | - ]); |
|
66 | - } |
|
47 | + /** |
|
48 | + * Create a Tree |
|
49 | + * |
|
50 | + * @link https://developer.github.com/v3/git/trees/#create-a-tree |
|
51 | + * |
|
52 | + * @param array $tree |
|
53 | + * @param string $base_tree |
|
54 | + * |
|
55 | + * @return array |
|
56 | + * @throws \Exception |
|
57 | + */ |
|
58 | + public function create(array $tree, string $base_tree): array |
|
59 | + { |
|
60 | + return $this->getApi()->request($this->getApi() |
|
61 | + ->sprintf('/repos/:owner/:repo/git/trees', $this->getGitData()->getOwner(), |
|
62 | + $this->getGitData()->getRepo()), Request::METHOD_POST, [ |
|
63 | + 'tree' => $tree, |
|
64 | + 'base_tree' => $base_tree |
|
65 | + ]); |
|
66 | + } |
|
67 | 67 | } |
68 | 68 | \ No newline at end of file |