@@ -12,91 +12,91 @@ |
||
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 string $gistId |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function listComments(string $gistId): array |
|
25 | - { |
|
26 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments', $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 string $gistId |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function listComments(string $gistId): array |
|
25 | + { |
|
26 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments', $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 string $gistId |
|
35 | - * @param int $id |
|
36 | - * |
|
37 | - * @return array |
|
38 | - */ |
|
39 | - public function getSingleComment(string $gistId, int $id): array |
|
40 | - { |
|
41 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments/:id', $gistId, (string)$id)); |
|
42 | - } |
|
29 | + /** |
|
30 | + * Get a single comment |
|
31 | + * |
|
32 | + * @link https://developer.github.com/v3/gists/comments/#get-a-single-comment |
|
33 | + * |
|
34 | + * @param string $gistId |
|
35 | + * @param int $id |
|
36 | + * |
|
37 | + * @return array |
|
38 | + */ |
|
39 | + public function getSingleComment(string $gistId, int $id): array |
|
40 | + { |
|
41 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments/:id', $gistId, (string)$id)); |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * Create a comment |
|
46 | - * |
|
47 | - * @link https://developer.github.com/v3/gists/comments/#create-a-comment |
|
48 | - * |
|
49 | - * @param string $gistId |
|
50 | - * @param string $body |
|
51 | - * |
|
52 | - * @return array |
|
53 | - */ |
|
54 | - public function createComment(string $gistId, string $body): array |
|
55 | - { |
|
56 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments', $gistId), |
|
57 | - Request::METHOD_POST, [ |
|
58 | - 'body' => $body |
|
59 | - ]); |
|
60 | - } |
|
44 | + /** |
|
45 | + * Create a comment |
|
46 | + * |
|
47 | + * @link https://developer.github.com/v3/gists/comments/#create-a-comment |
|
48 | + * |
|
49 | + * @param string $gistId |
|
50 | + * @param string $body |
|
51 | + * |
|
52 | + * @return array |
|
53 | + */ |
|
54 | + public function createComment(string $gistId, string $body): array |
|
55 | + { |
|
56 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments', $gistId), |
|
57 | + Request::METHOD_POST, [ |
|
58 | + 'body' => $body |
|
59 | + ]); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Edit a comment |
|
64 | - * |
|
65 | - * @link https://developer.github.com/v3/gists/comments/#edit-a-comment |
|
66 | - * |
|
67 | - * @param string $gistId |
|
68 | - * @param int $id |
|
69 | - * @param string $body |
|
70 | - * |
|
71 | - * @return array |
|
72 | - */ |
|
73 | - public function editComment(string $gistId, int $id, string $body): array |
|
74 | - { |
|
75 | - return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments/:id', $gistId, (string)$id), |
|
76 | - Request::METHOD_PATCH, [ |
|
77 | - 'body' => $body |
|
78 | - ]); |
|
79 | - } |
|
62 | + /** |
|
63 | + * Edit a comment |
|
64 | + * |
|
65 | + * @link https://developer.github.com/v3/gists/comments/#edit-a-comment |
|
66 | + * |
|
67 | + * @param string $gistId |
|
68 | + * @param int $id |
|
69 | + * @param string $body |
|
70 | + * |
|
71 | + * @return array |
|
72 | + */ |
|
73 | + public function editComment(string $gistId, int $id, string $body): array |
|
74 | + { |
|
75 | + return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments/:id', $gistId, (string)$id), |
|
76 | + Request::METHOD_PATCH, [ |
|
77 | + 'body' => $body |
|
78 | + ]); |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * Delete a comment |
|
83 | - * |
|
84 | - * @link https://developer.github.com/v3/gists/comments/#delete-a-comment |
|
85 | - * |
|
86 | - * @param string $gistId |
|
87 | - * @param int $id |
|
88 | - * |
|
89 | - * @return bool |
|
90 | - */ |
|
91 | - public function deleteComment(string $gistId, int $id): bool |
|
92 | - { |
|
93 | - $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments/:id', $gistId, (string)$id), |
|
94 | - Request::METHOD_DELETE); |
|
81 | + /** |
|
82 | + * Delete a comment |
|
83 | + * |
|
84 | + * @link https://developer.github.com/v3/gists/comments/#delete-a-comment |
|
85 | + * |
|
86 | + * @param string $gistId |
|
87 | + * @param int $id |
|
88 | + * |
|
89 | + * @return bool |
|
90 | + */ |
|
91 | + public function deleteComment(string $gistId, int $id): bool |
|
92 | + { |
|
93 | + $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments/:id', $gistId, (string)$id), |
|
94 | + Request::METHOD_DELETE); |
|
95 | 95 | |
96 | - if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
97 | - return true; |
|
98 | - } |
|
96 | + if ($this->getApi()->getHeaders()['Status'] == '204 No Content') { |
|
97 | + return true; |
|
98 | + } |
|
99 | 99 | |
100 | - return false; |
|
101 | - } |
|
100 | + return false; |
|
101 | + } |
|
102 | 102 | } |
103 | 103 | \ No newline at end of file |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | namespace FlexyProject\GitHub\Tests\Receiver; |
3 | 3 | |
4 | 4 | use FlexyProject\GitHub\{ |
5 | - Client, Receiver\Gists, Tests\AbstractTest |
|
5 | + Client, Receiver\Gists, Tests\AbstractTest |
|
6 | 6 | }; |
7 | 7 | |
8 | 8 | /** |
@@ -12,327 +12,327 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class GistsTest extends AbstractTest |
14 | 14 | { |
15 | - /** Public test gist ID */ |
|
16 | - const PUBLIC_GIST = '76e253825bb3c6c084cf31f92997eb72'; |
|
17 | - |
|
18 | - /** @var Gists */ |
|
19 | - protected $gists; |
|
20 | - |
|
21 | - /** @var Gists\Comments */ |
|
22 | - protected $comments; |
|
23 | - |
|
24 | - /** |
|
25 | - * GistsTest constructor. |
|
26 | - * |
|
27 | - * @param null $name |
|
28 | - * @param array $data |
|
29 | - * @param string $dataName |
|
30 | - */ |
|
31 | - public function __construct($name = null, array $data = [], $dataName = '') |
|
32 | - { |
|
33 | - parent::__construct($name, $data, $dataName); |
|
34 | - |
|
35 | - // Gists |
|
36 | - $this->gists = $this->client->getReceiver(Client::GISTS); |
|
37 | - |
|
38 | - // Comments |
|
39 | - $this->comments = $this->gists->getReceiver(Gists::COMMENTS); |
|
40 | - } |
|
41 | - |
|
42 | - /** |
|
43 | - * Test list gists of current users |
|
44 | - */ |
|
45 | - public function testListGists() |
|
46 | - { |
|
47 | - $gists = $this->gists->listGists(); |
|
48 | - if (!empty($gists)) { |
|
49 | - $gist = array_pop($gists); |
|
50 | - |
|
51 | - $this->assertArrayHasKey('url', $gist); |
|
52 | - $this->assertArrayHasKey('files', $gist); |
|
53 | - $this->assertArrayHasKey('comments', $gist); |
|
54 | - $this->assertArrayHasKey('created_at', $gist); |
|
55 | - $this->assertArrayHasKey('updated_at', $gist); |
|
56 | - $this->assertArrayHasKey('user', $gist); |
|
57 | - } |
|
58 | - } |
|
59 | - |
|
60 | - /** |
|
61 | - * Test list public gists |
|
62 | - */ |
|
63 | - public function testPublicListGists() |
|
64 | - { |
|
65 | - $gists = $this->gists->listPublicGists(); |
|
66 | - if (!empty($gists)) { |
|
67 | - $gist = array_pop($gists); |
|
68 | - |
|
69 | - $this->assertArrayHasKey('url', $gist); |
|
70 | - $this->assertArrayHasKey('files', $gist); |
|
71 | - $this->assertArrayHasKey('comments', $gist); |
|
72 | - $this->assertArrayHasKey('created_at', $gist); |
|
73 | - $this->assertArrayHasKey('updated_at', $gist); |
|
74 | - $this->assertArrayHasKey('user', $gist); |
|
75 | - } |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * Test list user's starred gists |
|
80 | - */ |
|
81 | - public function testListUsersStarredGists() |
|
82 | - { |
|
83 | - $gists = $this->gists->listUsersStarredGists(); |
|
84 | - if (!empty($gists)) { |
|
85 | - $gist = array_pop($gists); |
|
86 | - |
|
87 | - $this->assertArrayHasKey('url', $gist); |
|
88 | - $this->assertArrayHasKey('files', $gist); |
|
89 | - $this->assertArrayHasKey('comments', $gist); |
|
90 | - $this->assertArrayHasKey('created_at', $gist); |
|
91 | - $this->assertArrayHasKey('updated_at', $gist); |
|
92 | - $this->assertArrayHasKey('user', $gist); |
|
93 | - } |
|
94 | - } |
|
95 | - |
|
96 | - /** |
|
97 | - * Test creating a new gist |
|
98 | - * |
|
99 | - * @return string |
|
100 | - */ |
|
101 | - public function testCreateGist(): string |
|
102 | - { |
|
103 | - $gist = $this->gists->createGist([ |
|
104 | - md5('phpunit-testing') . '.txt' => [ |
|
105 | - 'content' => 'String file contents' |
|
106 | - ] |
|
107 | - ], 'the description for this gist'); |
|
108 | - |
|
109 | - $this->assertArrayHasKey('url', $gist); |
|
110 | - $this->assertArrayHasKey('files', $gist); |
|
111 | - $this->assertArrayHasKey('comments', $gist); |
|
112 | - $this->assertArrayHasKey('created_at', $gist); |
|
113 | - $this->assertArrayHasKey('updated_at', $gist); |
|
114 | - $this->assertArrayHasKey('user', $gist); |
|
115 | - |
|
116 | - return $gist['id']; |
|
117 | - } |
|
118 | - |
|
119 | - /** |
|
120 | - * Test getting gist by ID |
|
121 | - * |
|
122 | - * @depends testCreateGist |
|
123 | - * |
|
124 | - * @param string $gistId |
|
125 | - */ |
|
126 | - public function testGetGistById(string $gistId) |
|
127 | - { |
|
128 | - $gist = $this->gists->getGist($gistId); |
|
129 | - |
|
130 | - $this->assertArrayHasKey('url', $gist); |
|
131 | - $this->assertArrayHasKey('files', $gist); |
|
132 | - $this->assertArrayHasKey('comments', $gist); |
|
133 | - $this->assertArrayHasKey('created_at', $gist); |
|
134 | - $this->assertArrayHasKey('updated_at', $gist); |
|
135 | - $this->assertArrayHasKey('user', $gist); |
|
136 | - } |
|
137 | - |
|
138 | - /** |
|
139 | - * Test updating an existing gist |
|
140 | - * |
|
141 | - * @depends testCreateGist |
|
142 | - * |
|
143 | - * @param string $gistId |
|
144 | - */ |
|
145 | - public function testUpdateGist(string $gistId) |
|
146 | - { |
|
147 | - $gist = $this->gists->editGist($gistId, 'the description UPDATED for this gist', [ |
|
148 | - md5('phpunit-testing') . '.txt' => [ |
|
149 | - 'content' => 'String file contents' |
|
150 | - ] |
|
151 | - ], 'content', 'renamed-file.name'); |
|
152 | - |
|
153 | - $this->assertEquals('the description UPDATED for this gist', $gist['description']); |
|
154 | - } |
|
155 | - |
|
156 | - /** |
|
157 | - * Test list commits of a gist |
|
158 | - * |
|
159 | - * @depends testCreateGist |
|
160 | - * |
|
161 | - * @param string $gistId |
|
162 | - */ |
|
163 | - public function testListGistsCommit(string $gistId) |
|
164 | - { |
|
165 | - $gists = $this->gists->listGistsCommits($gistId); |
|
166 | - $gist = array_pop($gists); |
|
167 | - |
|
168 | - $this->assertArrayHasKey('user', $gist); |
|
169 | - $this->assertArrayHasKey('version', $gist); |
|
170 | - $this->assertArrayHasKey('committed_at', $gist); |
|
171 | - $this->assertArrayHasKey('change_status', $gist); |
|
172 | - $this->assertArrayHasKey('url', $gist); |
|
173 | - } |
|
174 | - |
|
175 | - /** |
|
176 | - * Test starring a gist |
|
177 | - * |
|
178 | - * @depends testCreateGist |
|
179 | - * |
|
180 | - * @param string $gistId |
|
181 | - */ |
|
182 | - public function testStarGist(string $gistId) |
|
183 | - { |
|
184 | - $this->assertTrue($this->gists->starGist($gistId)); |
|
185 | - } |
|
186 | - |
|
187 | - /** |
|
188 | - * Test gist is starred |
|
189 | - * |
|
190 | - * @depends testCreateGist |
|
191 | - * |
|
192 | - * @param string $gistId |
|
193 | - */ |
|
194 | - public function testGistIsStarred(string $gistId) |
|
195 | - { |
|
196 | - $this->assertTrue($this->gists->checkGistIsStarred($gistId)); |
|
197 | - } |
|
198 | - |
|
199 | - /** |
|
200 | - * Test unstar a gist |
|
201 | - * |
|
202 | - * @depends testCreateGist |
|
203 | - * |
|
204 | - * @param string $gistId |
|
205 | - */ |
|
206 | - public function testUnStarGist(string $gistId) |
|
207 | - { |
|
208 | - $this->assertTrue($this->gists->unStarGist($gistId)); |
|
209 | - } |
|
210 | - |
|
211 | - /** |
|
212 | - * Test fork a public gist |
|
213 | - */ |
|
214 | - public function testForkGist() |
|
215 | - { |
|
216 | - $gist = $this->gists->forkGist(self::PUBLIC_GIST); |
|
217 | - |
|
218 | - $this->assertArrayHasKey('forks_url', $gist); |
|
219 | - |
|
220 | - return $gist['id']; |
|
221 | - } |
|
222 | - |
|
223 | - /** |
|
224 | - * Test list forks of a specific gist |
|
225 | - */ |
|
226 | - public function testListGistForks() |
|
227 | - { |
|
228 | - $gists = $this->gists->listGistForks(self::PUBLIC_GIST); |
|
229 | - $gist = array_pop($gists); |
|
230 | - |
|
231 | - $this->assertArrayHasKey('url', $gist); |
|
232 | - $this->assertArrayHasKey('id', $gist); |
|
233 | - } |
|
234 | - |
|
235 | - /** |
|
236 | - * Test deleting a forked gist |
|
237 | - * |
|
238 | - * @depends testForkGist |
|
239 | - * |
|
240 | - * @param string $gistId |
|
241 | - */ |
|
242 | - public function testDeleteForkedGist(string $gistId) |
|
243 | - { |
|
244 | - $this->assertTrue($this->gists->deleteGist($gistId)); |
|
245 | - } |
|
246 | - |
|
247 | - /** |
|
248 | - * Test create a new comment in specific gist |
|
249 | - * |
|
250 | - * @depends testCreateGist |
|
251 | - * |
|
252 | - * @param string $gistId |
|
253 | - */ |
|
254 | - public function testCreateComment(string $gistId) |
|
255 | - { |
|
256 | - $response = $this->comments->createComment($gistId, 'Just commenting for the sake of commenting'); |
|
257 | - |
|
258 | - $this->assertEquals('Just commenting for the sake of commenting', $response['body']); |
|
259 | - |
|
260 | - return $response['id']; |
|
261 | - } |
|
262 | - |
|
263 | - /** |
|
264 | - * Test listing all comments for specific gist |
|
265 | - * |
|
266 | - * @depends testCreateGist |
|
267 | - * |
|
268 | - * @param string $gistId |
|
269 | - */ |
|
270 | - public function testListComments(string $gistId) |
|
271 | - { |
|
272 | - $comments = $this->comments->listComments($gistId); |
|
273 | - $comment = array_pop($comments); |
|
274 | - |
|
275 | - $this->assertArrayHasKey('id', $comment); |
|
276 | - $this->assertArrayHasKey('url', $comment); |
|
277 | - $this->assertArrayHasKey('body', $comment); |
|
278 | - } |
|
279 | - |
|
280 | - /** |
|
281 | - * Test getting a single comment |
|
282 | - * |
|
283 | - * @depends testCreateGist |
|
284 | - * @depends testCreateComment |
|
285 | - * |
|
286 | - * @param string $gistId |
|
287 | - * @param string $commentId |
|
288 | - */ |
|
289 | - public function testGetSingleComment(string $gistId, string $commentId) |
|
290 | - { |
|
291 | - $response = $this->comments->getSingleComment($gistId, $commentId); |
|
292 | - |
|
293 | - $this->assertEquals('Just commenting for the sake of commenting', $response['body']); |
|
294 | - } |
|
295 | - |
|
296 | - /** |
|
297 | - * Test editing a gist's comment |
|
298 | - * |
|
299 | - * @depends testCreateGist |
|
300 | - * @depends testCreateComment |
|
301 | - * |
|
302 | - * @param string $gistId |
|
303 | - * @param string $commentId |
|
304 | - */ |
|
305 | - public function testEditComment(string $gistId, string $commentId) |
|
306 | - { |
|
307 | - $response = $this->comments->editComment($gistId, $commentId, 'Just editing this comment!'); |
|
308 | - |
|
309 | - $this->assertEquals('Just editing this comment!', $response['body']); |
|
310 | - } |
|
311 | - |
|
312 | - /** |
|
313 | - * Test deleting a comment |
|
314 | - * |
|
315 | - * @depends testCreateGist |
|
316 | - * @depends testCreateComment |
|
317 | - * |
|
318 | - * @param string $gistId |
|
319 | - * @param string $commentId |
|
320 | - */ |
|
321 | - public function testDeleteComment(string $gistId, string $commentId) |
|
322 | - { |
|
323 | - $this->assertTrue($this->comments->deleteComment($gistId, $commentId)); |
|
324 | - } |
|
325 | - |
|
326 | - /** |
|
327 | - * Test deleting an existing gist |
|
328 | - * |
|
329 | - * @depends testCreateGist |
|
330 | - * |
|
331 | - * @param string $gistId |
|
332 | - */ |
|
333 | - public function testDeleteGist(string $gistId) |
|
334 | - { |
|
335 | - $this->assertTrue($this->gists->deleteGist($gistId)); |
|
336 | - } |
|
15 | + /** Public test gist ID */ |
|
16 | + const PUBLIC_GIST = '76e253825bb3c6c084cf31f92997eb72'; |
|
17 | + |
|
18 | + /** @var Gists */ |
|
19 | + protected $gists; |
|
20 | + |
|
21 | + /** @var Gists\Comments */ |
|
22 | + protected $comments; |
|
23 | + |
|
24 | + /** |
|
25 | + * GistsTest constructor. |
|
26 | + * |
|
27 | + * @param null $name |
|
28 | + * @param array $data |
|
29 | + * @param string $dataName |
|
30 | + */ |
|
31 | + public function __construct($name = null, array $data = [], $dataName = '') |
|
32 | + { |
|
33 | + parent::__construct($name, $data, $dataName); |
|
34 | + |
|
35 | + // Gists |
|
36 | + $this->gists = $this->client->getReceiver(Client::GISTS); |
|
37 | + |
|
38 | + // Comments |
|
39 | + $this->comments = $this->gists->getReceiver(Gists::COMMENTS); |
|
40 | + } |
|
41 | + |
|
42 | + /** |
|
43 | + * Test list gists of current users |
|
44 | + */ |
|
45 | + public function testListGists() |
|
46 | + { |
|
47 | + $gists = $this->gists->listGists(); |
|
48 | + if (!empty($gists)) { |
|
49 | + $gist = array_pop($gists); |
|
50 | + |
|
51 | + $this->assertArrayHasKey('url', $gist); |
|
52 | + $this->assertArrayHasKey('files', $gist); |
|
53 | + $this->assertArrayHasKey('comments', $gist); |
|
54 | + $this->assertArrayHasKey('created_at', $gist); |
|
55 | + $this->assertArrayHasKey('updated_at', $gist); |
|
56 | + $this->assertArrayHasKey('user', $gist); |
|
57 | + } |
|
58 | + } |
|
59 | + |
|
60 | + /** |
|
61 | + * Test list public gists |
|
62 | + */ |
|
63 | + public function testPublicListGists() |
|
64 | + { |
|
65 | + $gists = $this->gists->listPublicGists(); |
|
66 | + if (!empty($gists)) { |
|
67 | + $gist = array_pop($gists); |
|
68 | + |
|
69 | + $this->assertArrayHasKey('url', $gist); |
|
70 | + $this->assertArrayHasKey('files', $gist); |
|
71 | + $this->assertArrayHasKey('comments', $gist); |
|
72 | + $this->assertArrayHasKey('created_at', $gist); |
|
73 | + $this->assertArrayHasKey('updated_at', $gist); |
|
74 | + $this->assertArrayHasKey('user', $gist); |
|
75 | + } |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * Test list user's starred gists |
|
80 | + */ |
|
81 | + public function testListUsersStarredGists() |
|
82 | + { |
|
83 | + $gists = $this->gists->listUsersStarredGists(); |
|
84 | + if (!empty($gists)) { |
|
85 | + $gist = array_pop($gists); |
|
86 | + |
|
87 | + $this->assertArrayHasKey('url', $gist); |
|
88 | + $this->assertArrayHasKey('files', $gist); |
|
89 | + $this->assertArrayHasKey('comments', $gist); |
|
90 | + $this->assertArrayHasKey('created_at', $gist); |
|
91 | + $this->assertArrayHasKey('updated_at', $gist); |
|
92 | + $this->assertArrayHasKey('user', $gist); |
|
93 | + } |
|
94 | + } |
|
95 | + |
|
96 | + /** |
|
97 | + * Test creating a new gist |
|
98 | + * |
|
99 | + * @return string |
|
100 | + */ |
|
101 | + public function testCreateGist(): string |
|
102 | + { |
|
103 | + $gist = $this->gists->createGist([ |
|
104 | + md5('phpunit-testing') . '.txt' => [ |
|
105 | + 'content' => 'String file contents' |
|
106 | + ] |
|
107 | + ], 'the description for this gist'); |
|
108 | + |
|
109 | + $this->assertArrayHasKey('url', $gist); |
|
110 | + $this->assertArrayHasKey('files', $gist); |
|
111 | + $this->assertArrayHasKey('comments', $gist); |
|
112 | + $this->assertArrayHasKey('created_at', $gist); |
|
113 | + $this->assertArrayHasKey('updated_at', $gist); |
|
114 | + $this->assertArrayHasKey('user', $gist); |
|
115 | + |
|
116 | + return $gist['id']; |
|
117 | + } |
|
118 | + |
|
119 | + /** |
|
120 | + * Test getting gist by ID |
|
121 | + * |
|
122 | + * @depends testCreateGist |
|
123 | + * |
|
124 | + * @param string $gistId |
|
125 | + */ |
|
126 | + public function testGetGistById(string $gistId) |
|
127 | + { |
|
128 | + $gist = $this->gists->getGist($gistId); |
|
129 | + |
|
130 | + $this->assertArrayHasKey('url', $gist); |
|
131 | + $this->assertArrayHasKey('files', $gist); |
|
132 | + $this->assertArrayHasKey('comments', $gist); |
|
133 | + $this->assertArrayHasKey('created_at', $gist); |
|
134 | + $this->assertArrayHasKey('updated_at', $gist); |
|
135 | + $this->assertArrayHasKey('user', $gist); |
|
136 | + } |
|
137 | + |
|
138 | + /** |
|
139 | + * Test updating an existing gist |
|
140 | + * |
|
141 | + * @depends testCreateGist |
|
142 | + * |
|
143 | + * @param string $gistId |
|
144 | + */ |
|
145 | + public function testUpdateGist(string $gistId) |
|
146 | + { |
|
147 | + $gist = $this->gists->editGist($gistId, 'the description UPDATED for this gist', [ |
|
148 | + md5('phpunit-testing') . '.txt' => [ |
|
149 | + 'content' => 'String file contents' |
|
150 | + ] |
|
151 | + ], 'content', 'renamed-file.name'); |
|
152 | + |
|
153 | + $this->assertEquals('the description UPDATED for this gist', $gist['description']); |
|
154 | + } |
|
155 | + |
|
156 | + /** |
|
157 | + * Test list commits of a gist |
|
158 | + * |
|
159 | + * @depends testCreateGist |
|
160 | + * |
|
161 | + * @param string $gistId |
|
162 | + */ |
|
163 | + public function testListGistsCommit(string $gistId) |
|
164 | + { |
|
165 | + $gists = $this->gists->listGistsCommits($gistId); |
|
166 | + $gist = array_pop($gists); |
|
167 | + |
|
168 | + $this->assertArrayHasKey('user', $gist); |
|
169 | + $this->assertArrayHasKey('version', $gist); |
|
170 | + $this->assertArrayHasKey('committed_at', $gist); |
|
171 | + $this->assertArrayHasKey('change_status', $gist); |
|
172 | + $this->assertArrayHasKey('url', $gist); |
|
173 | + } |
|
174 | + |
|
175 | + /** |
|
176 | + * Test starring a gist |
|
177 | + * |
|
178 | + * @depends testCreateGist |
|
179 | + * |
|
180 | + * @param string $gistId |
|
181 | + */ |
|
182 | + public function testStarGist(string $gistId) |
|
183 | + { |
|
184 | + $this->assertTrue($this->gists->starGist($gistId)); |
|
185 | + } |
|
186 | + |
|
187 | + /** |
|
188 | + * Test gist is starred |
|
189 | + * |
|
190 | + * @depends testCreateGist |
|
191 | + * |
|
192 | + * @param string $gistId |
|
193 | + */ |
|
194 | + public function testGistIsStarred(string $gistId) |
|
195 | + { |
|
196 | + $this->assertTrue($this->gists->checkGistIsStarred($gistId)); |
|
197 | + } |
|
198 | + |
|
199 | + /** |
|
200 | + * Test unstar a gist |
|
201 | + * |
|
202 | + * @depends testCreateGist |
|
203 | + * |
|
204 | + * @param string $gistId |
|
205 | + */ |
|
206 | + public function testUnStarGist(string $gistId) |
|
207 | + { |
|
208 | + $this->assertTrue($this->gists->unStarGist($gistId)); |
|
209 | + } |
|
210 | + |
|
211 | + /** |
|
212 | + * Test fork a public gist |
|
213 | + */ |
|
214 | + public function testForkGist() |
|
215 | + { |
|
216 | + $gist = $this->gists->forkGist(self::PUBLIC_GIST); |
|
217 | + |
|
218 | + $this->assertArrayHasKey('forks_url', $gist); |
|
219 | + |
|
220 | + return $gist['id']; |
|
221 | + } |
|
222 | + |
|
223 | + /** |
|
224 | + * Test list forks of a specific gist |
|
225 | + */ |
|
226 | + public function testListGistForks() |
|
227 | + { |
|
228 | + $gists = $this->gists->listGistForks(self::PUBLIC_GIST); |
|
229 | + $gist = array_pop($gists); |
|
230 | + |
|
231 | + $this->assertArrayHasKey('url', $gist); |
|
232 | + $this->assertArrayHasKey('id', $gist); |
|
233 | + } |
|
234 | + |
|
235 | + /** |
|
236 | + * Test deleting a forked gist |
|
237 | + * |
|
238 | + * @depends testForkGist |
|
239 | + * |
|
240 | + * @param string $gistId |
|
241 | + */ |
|
242 | + public function testDeleteForkedGist(string $gistId) |
|
243 | + { |
|
244 | + $this->assertTrue($this->gists->deleteGist($gistId)); |
|
245 | + } |
|
246 | + |
|
247 | + /** |
|
248 | + * Test create a new comment in specific gist |
|
249 | + * |
|
250 | + * @depends testCreateGist |
|
251 | + * |
|
252 | + * @param string $gistId |
|
253 | + */ |
|
254 | + public function testCreateComment(string $gistId) |
|
255 | + { |
|
256 | + $response = $this->comments->createComment($gistId, 'Just commenting for the sake of commenting'); |
|
257 | + |
|
258 | + $this->assertEquals('Just commenting for the sake of commenting', $response['body']); |
|
259 | + |
|
260 | + return $response['id']; |
|
261 | + } |
|
262 | + |
|
263 | + /** |
|
264 | + * Test listing all comments for specific gist |
|
265 | + * |
|
266 | + * @depends testCreateGist |
|
267 | + * |
|
268 | + * @param string $gistId |
|
269 | + */ |
|
270 | + public function testListComments(string $gistId) |
|
271 | + { |
|
272 | + $comments = $this->comments->listComments($gistId); |
|
273 | + $comment = array_pop($comments); |
|
274 | + |
|
275 | + $this->assertArrayHasKey('id', $comment); |
|
276 | + $this->assertArrayHasKey('url', $comment); |
|
277 | + $this->assertArrayHasKey('body', $comment); |
|
278 | + } |
|
279 | + |
|
280 | + /** |
|
281 | + * Test getting a single comment |
|
282 | + * |
|
283 | + * @depends testCreateGist |
|
284 | + * @depends testCreateComment |
|
285 | + * |
|
286 | + * @param string $gistId |
|
287 | + * @param string $commentId |
|
288 | + */ |
|
289 | + public function testGetSingleComment(string $gistId, string $commentId) |
|
290 | + { |
|
291 | + $response = $this->comments->getSingleComment($gistId, $commentId); |
|
292 | + |
|
293 | + $this->assertEquals('Just commenting for the sake of commenting', $response['body']); |
|
294 | + } |
|
295 | + |
|
296 | + /** |
|
297 | + * Test editing a gist's comment |
|
298 | + * |
|
299 | + * @depends testCreateGist |
|
300 | + * @depends testCreateComment |
|
301 | + * |
|
302 | + * @param string $gistId |
|
303 | + * @param string $commentId |
|
304 | + */ |
|
305 | + public function testEditComment(string $gistId, string $commentId) |
|
306 | + { |
|
307 | + $response = $this->comments->editComment($gistId, $commentId, 'Just editing this comment!'); |
|
308 | + |
|
309 | + $this->assertEquals('Just editing this comment!', $response['body']); |
|
310 | + } |
|
311 | + |
|
312 | + /** |
|
313 | + * Test deleting a comment |
|
314 | + * |
|
315 | + * @depends testCreateGist |
|
316 | + * @depends testCreateComment |
|
317 | + * |
|
318 | + * @param string $gistId |
|
319 | + * @param string $commentId |
|
320 | + */ |
|
321 | + public function testDeleteComment(string $gistId, string $commentId) |
|
322 | + { |
|
323 | + $this->assertTrue($this->comments->deleteComment($gistId, $commentId)); |
|
324 | + } |
|
325 | + |
|
326 | + /** |
|
327 | + * Test deleting an existing gist |
|
328 | + * |
|
329 | + * @depends testCreateGist |
|
330 | + * |
|
331 | + * @param string $gistId |
|
332 | + */ |
|
333 | + public function testDeleteGist(string $gistId) |
|
334 | + { |
|
335 | + $this->assertTrue($this->gists->deleteGist($gistId)); |
|
336 | + } |
|
337 | 337 | |
338 | 338 | } |
339 | 339 | \ No newline at end of file |
@@ -10,88 +10,88 @@ |
||
10 | 10 | */ |
11 | 11 | abstract class AbstractReceiver |
12 | 12 | { |
13 | - /** Api trait */ |
|
14 | - use Api; |
|
13 | + /** Api trait */ |
|
14 | + use Api; |
|
15 | 15 | |
16 | - /** Protected properties */ |
|
17 | - protected $owner = ''; |
|
18 | - protected $repo = ''; |
|
16 | + /** Protected properties */ |
|
17 | + protected $owner = ''; |
|
18 | + protected $repo = ''; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Constructor |
|
22 | - * |
|
23 | - * @param AbstractApi $api |
|
24 | - */ |
|
25 | - public function __construct(AbstractApi $api) |
|
26 | - { |
|
27 | - $this->setApi($api); |
|
28 | - } |
|
20 | + /** |
|
21 | + * Constructor |
|
22 | + * |
|
23 | + * @param AbstractApi $api |
|
24 | + */ |
|
25 | + public function __construct(AbstractApi $api) |
|
26 | + { |
|
27 | + $this->setApi($api); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Get owner |
|
32 | - * |
|
33 | - * @return string |
|
34 | - */ |
|
35 | - public function getOwner(): string |
|
36 | - { |
|
37 | - return $this->owner; |
|
38 | - } |
|
30 | + /** |
|
31 | + * Get owner |
|
32 | + * |
|
33 | + * @return string |
|
34 | + */ |
|
35 | + public function getOwner(): string |
|
36 | + { |
|
37 | + return $this->owner; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Set owner |
|
42 | - * |
|
43 | - * @param string $owner |
|
44 | - * |
|
45 | - * @return AbstractReceiver |
|
46 | - */ |
|
47 | - public function setOwner(string $owner): AbstractReceiver |
|
48 | - { |
|
49 | - $this->owner = $owner; |
|
40 | + /** |
|
41 | + * Set owner |
|
42 | + * |
|
43 | + * @param string $owner |
|
44 | + * |
|
45 | + * @return AbstractReceiver |
|
46 | + */ |
|
47 | + public function setOwner(string $owner): AbstractReceiver |
|
48 | + { |
|
49 | + $this->owner = $owner; |
|
50 | 50 | |
51 | - return $this; |
|
52 | - } |
|
51 | + return $this; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Get repository |
|
56 | - * |
|
57 | - * @return string |
|
58 | - */ |
|
59 | - public function getRepo(): string |
|
60 | - { |
|
61 | - return $this->repo; |
|
62 | - } |
|
54 | + /** |
|
55 | + * Get repository |
|
56 | + * |
|
57 | + * @return string |
|
58 | + */ |
|
59 | + public function getRepo(): string |
|
60 | + { |
|
61 | + return $this->repo; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * Set repository |
|
66 | - * |
|
67 | - * @param string $repo |
|
68 | - * |
|
69 | - * @return AbstractReceiver |
|
70 | - */ |
|
71 | - public function setRepo(string $repo): AbstractReceiver |
|
72 | - { |
|
73 | - $this->repo = $repo; |
|
64 | + /** |
|
65 | + * Set repository |
|
66 | + * |
|
67 | + * @param string $repo |
|
68 | + * |
|
69 | + * @return AbstractReceiver |
|
70 | + */ |
|
71 | + public function setRepo(string $repo): AbstractReceiver |
|
72 | + { |
|
73 | + $this->repo = $repo; |
|
74 | 74 | |
75 | - return $this; |
|
76 | - } |
|
75 | + return $this; |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * Get a sub-receiver |
|
80 | - * |
|
81 | - * @param string $name |
|
82 | - * |
|
83 | - * @return null|object |
|
84 | - */ |
|
85 | - public function getReceiver(string $name) |
|
86 | - { |
|
87 | - $classPath = explode('\\', get_called_class()); |
|
88 | - $class = (string)$this->getApi() |
|
89 | - ->sprintf(':namespace\:class\:method', __NAMESPACE__, end($classPath), $name); |
|
78 | + /** |
|
79 | + * Get a sub-receiver |
|
80 | + * |
|
81 | + * @param string $name |
|
82 | + * |
|
83 | + * @return null|object |
|
84 | + */ |
|
85 | + public function getReceiver(string $name) |
|
86 | + { |
|
87 | + $classPath = explode('\\', get_called_class()); |
|
88 | + $class = (string)$this->getApi() |
|
89 | + ->sprintf(':namespace\:class\:method', __NAMESPACE__, end($classPath), $name); |
|
90 | 90 | |
91 | - if (class_exists($class)) { |
|
92 | - return new $class($this); |
|
93 | - } |
|
91 | + if (class_exists($class)) { |
|
92 | + return new $class($this); |
|
93 | + } |
|
94 | 94 | |
95 | - return null; |
|
96 | - } |
|
95 | + return null; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 | \ No newline at end of file |
@@ -12,44 +12,44 @@ |
||
12 | 12 | */ |
13 | 13 | abstract class AbstractGitData |
14 | 14 | { |
15 | - /** Api trait */ |
|
16 | - use Api; |
|
15 | + /** Api trait */ |
|
16 | + use Api; |
|
17 | 17 | |
18 | - /** Properties */ |
|
19 | - protected $gitData; |
|
18 | + /** Properties */ |
|
19 | + protected $gitData; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Constructor |
|
23 | - * |
|
24 | - * @param GitData $gitData |
|
25 | - */ |
|
26 | - public function __construct(GitData $gitData) |
|
27 | - { |
|
28 | - $this->setGitData($gitData); |
|
29 | - $this->setApi($gitData->getApi()); |
|
30 | - } |
|
21 | + /** |
|
22 | + * Constructor |
|
23 | + * |
|
24 | + * @param GitData $gitData |
|
25 | + */ |
|
26 | + public function __construct(GitData $gitData) |
|
27 | + { |
|
28 | + $this->setGitData($gitData); |
|
29 | + $this->setApi($gitData->getApi()); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * Get gitData |
|
34 | - * |
|
35 | - * @return GitData |
|
36 | - */ |
|
37 | - public function getGitData(): GitData |
|
38 | - { |
|
39 | - return $this->gitData; |
|
40 | - } |
|
32 | + /** |
|
33 | + * Get gitData |
|
34 | + * |
|
35 | + * @return GitData |
|
36 | + */ |
|
37 | + public function getGitData(): GitData |
|
38 | + { |
|
39 | + return $this->gitData; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Set gitData |
|
44 | - * |
|
45 | - * @param GitData $gitData |
|
46 | - * |
|
47 | - * @return AbstractGitData |
|
48 | - */ |
|
49 | - public function setGitData(GitData $gitData): AbstractGitData |
|
50 | - { |
|
51 | - $this->gitData = $gitData; |
|
42 | + /** |
|
43 | + * Set gitData |
|
44 | + * |
|
45 | + * @param GitData $gitData |
|
46 | + * |
|
47 | + * @return AbstractGitData |
|
48 | + */ |
|
49 | + public function setGitData(GitData $gitData): AbstractGitData |
|
50 | + { |
|
51 | + $this->gitData = $gitData; |
|
52 | 52 | |
53 | - return $this; |
|
54 | - } |
|
53 | + return $this; |
|
54 | + } |
|
55 | 55 | } |
56 | 56 | \ No newline at end of file |
@@ -12,44 +12,44 @@ |
||
12 | 12 | */ |
13 | 13 | abstract class AbstractPullRequests |
14 | 14 | { |
15 | - /** Api trait */ |
|
16 | - use Api; |
|
15 | + /** Api trait */ |
|
16 | + use Api; |
|
17 | 17 | |
18 | - /** Properties */ |
|
19 | - protected $pullRequests; |
|
18 | + /** Properties */ |
|
19 | + protected $pullRequests; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Constructor |
|
23 | - * |
|
24 | - * @param PullRequests $pullRequests |
|
25 | - */ |
|
26 | - public function __construct(PullRequests $pullRequests) |
|
27 | - { |
|
28 | - $this->setPullRequests($pullRequests); |
|
29 | - $this->setApi($pullRequests->getApi()); |
|
30 | - } |
|
21 | + /** |
|
22 | + * Constructor |
|
23 | + * |
|
24 | + * @param PullRequests $pullRequests |
|
25 | + */ |
|
26 | + public function __construct(PullRequests $pullRequests) |
|
27 | + { |
|
28 | + $this->setPullRequests($pullRequests); |
|
29 | + $this->setApi($pullRequests->getApi()); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * Get pullRequests |
|
34 | - * |
|
35 | - * @return PullRequests |
|
36 | - */ |
|
37 | - public function getPullRequests(): PullRequests |
|
38 | - { |
|
39 | - return $this->pullRequests; |
|
40 | - } |
|
32 | + /** |
|
33 | + * Get pullRequests |
|
34 | + * |
|
35 | + * @return PullRequests |
|
36 | + */ |
|
37 | + public function getPullRequests(): PullRequests |
|
38 | + { |
|
39 | + return $this->pullRequests; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Set pullRequests |
|
44 | - * |
|
45 | - * @param PullRequests $pullRequests |
|
46 | - * |
|
47 | - * @return AbstractPullRequests |
|
48 | - */ |
|
49 | - public function setPullRequests(PullRequests $pullRequests): AbstractPullRequests |
|
50 | - { |
|
51 | - $this->pullRequests = $pullRequests; |
|
42 | + /** |
|
43 | + * Set pullRequests |
|
44 | + * |
|
45 | + * @param PullRequests $pullRequests |
|
46 | + * |
|
47 | + * @return AbstractPullRequests |
|
48 | + */ |
|
49 | + public function setPullRequests(PullRequests $pullRequests): AbstractPullRequests |
|
50 | + { |
|
51 | + $this->pullRequests = $pullRequests; |
|
52 | 52 | |
53 | - return $this; |
|
54 | - } |
|
53 | + return $this; |
|
54 | + } |
|
55 | 55 | } |
56 | 56 | \ No newline at end of file |
@@ -12,44 +12,44 @@ |
||
12 | 12 | */ |
13 | 13 | abstract class AbstractGists |
14 | 14 | { |
15 | - /** Api trait */ |
|
16 | - use Api; |
|
15 | + /** Api trait */ |
|
16 | + use Api; |
|
17 | 17 | |
18 | - /** Properties */ |
|
19 | - protected $gists; |
|
18 | + /** Properties */ |
|
19 | + protected $gists; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Constructor |
|
23 | - * |
|
24 | - * @param Gists $gists |
|
25 | - */ |
|
26 | - public function __construct(Gists $gists) |
|
27 | - { |
|
28 | - $this->setGists($gists); |
|
29 | - $this->setApi($gists->getApi()); |
|
30 | - } |
|
21 | + /** |
|
22 | + * Constructor |
|
23 | + * |
|
24 | + * @param Gists $gists |
|
25 | + */ |
|
26 | + public function __construct(Gists $gists) |
|
27 | + { |
|
28 | + $this->setGists($gists); |
|
29 | + $this->setApi($gists->getApi()); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * Get gists |
|
34 | - * |
|
35 | - * @return Gists |
|
36 | - */ |
|
37 | - public function getGists(): Gists |
|
38 | - { |
|
39 | - return $this->gists; |
|
40 | - } |
|
32 | + /** |
|
33 | + * Get gists |
|
34 | + * |
|
35 | + * @return Gists |
|
36 | + */ |
|
37 | + public function getGists(): Gists |
|
38 | + { |
|
39 | + return $this->gists; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Set gists |
|
44 | - * |
|
45 | - * @param Gists $gists |
|
46 | - * |
|
47 | - * @return AbstractGists |
|
48 | - */ |
|
49 | - public function setGists(Gists $gists): AbstractGists |
|
50 | - { |
|
51 | - $this->gists = $gists; |
|
42 | + /** |
|
43 | + * Set gists |
|
44 | + * |
|
45 | + * @param Gists $gists |
|
46 | + * |
|
47 | + * @return AbstractGists |
|
48 | + */ |
|
49 | + public function setGists(Gists $gists): AbstractGists |
|
50 | + { |
|
51 | + $this->gists = $gists; |
|
52 | 52 | |
53 | - return $this; |
|
54 | - } |
|
53 | + return $this; |
|
54 | + } |
|
55 | 55 | } |
56 | 56 | \ No newline at end of file |
@@ -12,44 +12,44 @@ |
||
12 | 12 | */ |
13 | 13 | abstract class AbstractUsers |
14 | 14 | { |
15 | - /** Api trait */ |
|
16 | - use Api; |
|
15 | + /** Api trait */ |
|
16 | + use Api; |
|
17 | 17 | |
18 | - /** Properties */ |
|
19 | - protected $users; |
|
18 | + /** Properties */ |
|
19 | + protected $users; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Constructor |
|
23 | - * |
|
24 | - * @param Users $users |
|
25 | - */ |
|
26 | - public function __construct(Users $users) |
|
27 | - { |
|
28 | - $this->setUsers($users); |
|
29 | - $this->setApi($users->getApi()); |
|
30 | - } |
|
21 | + /** |
|
22 | + * Constructor |
|
23 | + * |
|
24 | + * @param Users $users |
|
25 | + */ |
|
26 | + public function __construct(Users $users) |
|
27 | + { |
|
28 | + $this->setUsers($users); |
|
29 | + $this->setApi($users->getApi()); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * Get users |
|
34 | - * |
|
35 | - * @return Users |
|
36 | - */ |
|
37 | - public function getUsers(): Users |
|
38 | - { |
|
39 | - return $this->users; |
|
40 | - } |
|
32 | + /** |
|
33 | + * Get users |
|
34 | + * |
|
35 | + * @return Users |
|
36 | + */ |
|
37 | + public function getUsers(): Users |
|
38 | + { |
|
39 | + return $this->users; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Set users |
|
44 | - * |
|
45 | - * @param Users $users |
|
46 | - * |
|
47 | - * @return AbstractUsers |
|
48 | - */ |
|
49 | - public function setUsers(Users $users): AbstractUsers |
|
50 | - { |
|
51 | - $this->users = $users; |
|
42 | + /** |
|
43 | + * Set users |
|
44 | + * |
|
45 | + * @param Users $users |
|
46 | + * |
|
47 | + * @return AbstractUsers |
|
48 | + */ |
|
49 | + public function setUsers(Users $users): AbstractUsers |
|
50 | + { |
|
51 | + $this->users = $users; |
|
52 | 52 | |
53 | - return $this; |
|
54 | - } |
|
53 | + return $this; |
|
54 | + } |
|
55 | 55 | } |
56 | 56 | \ No newline at end of file |
@@ -12,44 +12,44 @@ |
||
12 | 12 | */ |
13 | 13 | abstract class AbstractOrganizations |
14 | 14 | { |
15 | - /** Api trait */ |
|
16 | - use Api; |
|
15 | + /** Api trait */ |
|
16 | + use Api; |
|
17 | 17 | |
18 | - /** Properties */ |
|
19 | - protected $organizations; |
|
18 | + /** Properties */ |
|
19 | + protected $organizations; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Constructor |
|
23 | - * |
|
24 | - * @param Organizations $organizations |
|
25 | - */ |
|
26 | - public function __construct(Organizations $organizations) |
|
27 | - { |
|
28 | - $this->setOrganizations($organizations); |
|
29 | - $this->setApi($organizations->getApi()); |
|
30 | - } |
|
21 | + /** |
|
22 | + * Constructor |
|
23 | + * |
|
24 | + * @param Organizations $organizations |
|
25 | + */ |
|
26 | + public function __construct(Organizations $organizations) |
|
27 | + { |
|
28 | + $this->setOrganizations($organizations); |
|
29 | + $this->setApi($organizations->getApi()); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * Get organizations |
|
34 | - * |
|
35 | - * @return Organizations |
|
36 | - */ |
|
37 | - public function getOrganizations(): Organizations |
|
38 | - { |
|
39 | - return $this->organizations; |
|
40 | - } |
|
32 | + /** |
|
33 | + * Get organizations |
|
34 | + * |
|
35 | + * @return Organizations |
|
36 | + */ |
|
37 | + public function getOrganizations(): Organizations |
|
38 | + { |
|
39 | + return $this->organizations; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Set organizations |
|
44 | - * |
|
45 | - * @param Organizations $organizations |
|
46 | - * |
|
47 | - * @return AbstractOrganizations |
|
48 | - */ |
|
49 | - public function setOrganizations(Organizations $organizations): AbstractOrganizations |
|
50 | - { |
|
51 | - $this->organizations = $organizations; |
|
42 | + /** |
|
43 | + * Set organizations |
|
44 | + * |
|
45 | + * @param Organizations $organizations |
|
46 | + * |
|
47 | + * @return AbstractOrganizations |
|
48 | + */ |
|
49 | + public function setOrganizations(Organizations $organizations): AbstractOrganizations |
|
50 | + { |
|
51 | + $this->organizations = $organizations; |
|
52 | 52 | |
53 | - return $this; |
|
54 | - } |
|
53 | + return $this; |
|
54 | + } |
|
55 | 55 | } |
56 | 56 | \ No newline at end of file |
@@ -12,44 +12,44 @@ |
||
12 | 12 | */ |
13 | 13 | abstract class AbstractMiscellaneous |
14 | 14 | { |
15 | - /** Api trait */ |
|
16 | - use Api; |
|
15 | + /** Api trait */ |
|
16 | + use Api; |
|
17 | 17 | |
18 | - /** Properties */ |
|
19 | - protected $miscellaneous; |
|
18 | + /** Properties */ |
|
19 | + protected $miscellaneous; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Constructor |
|
23 | - * |
|
24 | - * @param Miscellaneous $miscellaneous |
|
25 | - */ |
|
26 | - public function __construct(Miscellaneous $miscellaneous) |
|
27 | - { |
|
28 | - $this->setMiscellaneous($miscellaneous); |
|
29 | - $this->setApi($miscellaneous->getApi()); |
|
30 | - } |
|
21 | + /** |
|
22 | + * Constructor |
|
23 | + * |
|
24 | + * @param Miscellaneous $miscellaneous |
|
25 | + */ |
|
26 | + public function __construct(Miscellaneous $miscellaneous) |
|
27 | + { |
|
28 | + $this->setMiscellaneous($miscellaneous); |
|
29 | + $this->setApi($miscellaneous->getApi()); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * Get miscellaneous |
|
34 | - * |
|
35 | - * @return Miscellaneous |
|
36 | - */ |
|
37 | - public function getMiscellaneous(): Miscellaneous |
|
38 | - { |
|
39 | - return $this->miscellaneous; |
|
40 | - } |
|
32 | + /** |
|
33 | + * Get miscellaneous |
|
34 | + * |
|
35 | + * @return Miscellaneous |
|
36 | + */ |
|
37 | + public function getMiscellaneous(): Miscellaneous |
|
38 | + { |
|
39 | + return $this->miscellaneous; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Set miscellaneous |
|
44 | - * |
|
45 | - * @param Miscellaneous $miscellaneous |
|
46 | - * |
|
47 | - * @return AbstractMiscellaneous |
|
48 | - */ |
|
49 | - public function setMiscellaneous(Miscellaneous $miscellaneous): AbstractMiscellaneous |
|
50 | - { |
|
51 | - $this->miscellaneous = $miscellaneous; |
|
42 | + /** |
|
43 | + * Set miscellaneous |
|
44 | + * |
|
45 | + * @param Miscellaneous $miscellaneous |
|
46 | + * |
|
47 | + * @return AbstractMiscellaneous |
|
48 | + */ |
|
49 | + public function setMiscellaneous(Miscellaneous $miscellaneous): AbstractMiscellaneous |
|
50 | + { |
|
51 | + $this->miscellaneous = $miscellaneous; |
|
52 | 52 | |
53 | - return $this; |
|
54 | - } |
|
53 | + return $this; |
|
54 | + } |
|
55 | 55 | } |
56 | 56 | \ No newline at end of file |