@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @return string |
121 | 121 | */ |
122 | - final public function __toString (): string { |
|
122 | + final public function __toString(): string { |
|
123 | 123 | return "tasks/{$this->getGid()}"; |
124 | 124 | } |
125 | 125 | |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @return string |
130 | 130 | */ |
131 | - final protected function _getDir (): string { |
|
131 | + final protected function _getDir(): string { |
|
132 | 132 | return 'tasks'; |
133 | 133 | } |
134 | 134 | |
135 | - private function _onSave (): void { |
|
135 | + private function _onSave(): void { |
|
136 | 136 | /** @var FieldEntries $fields */ |
137 | 137 | if ($fields = $this->data['custom_fields'] ?? null) { |
138 | 138 | $fields->__unset(true); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | - protected function _setData (array $data): void { |
|
146 | + protected function _setData(array $data): void { |
|
147 | 147 | // hearts were deprecated for likes |
148 | 148 | unset($data['hearted'], $data['hearts'], $data['num_hearts']); |
149 | 149 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @param string $file |
164 | 164 | * @return Attachment |
165 | 165 | */ |
166 | - public function addAttachment (string $file) { |
|
166 | + public function addAttachment(string $file) { |
|
167 | 167 | /** @var Attachment $attachment */ |
168 | 168 | $attachment = $this->api->factory($this, Attachment::class, ['parent' => $this]); |
169 | 169 | return $attachment->create($file); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @param string $text |
177 | 177 | * @return Story |
178 | 178 | */ |
179 | - public function addComment (string $text) { |
|
179 | + public function addComment(string $text) { |
|
180 | 180 | return $this->newComment()->setText($text)->create(); |
181 | 181 | } |
182 | 182 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @param Task[] $tasks |
188 | 188 | * @return $this |
189 | 189 | */ |
190 | - public function addDependencies (array $tasks) { |
|
190 | + public function addDependencies(array $tasks) { |
|
191 | 191 | $this->api->post("{$this}/addDependencies", ['dependents' => array_column($tasks, 'gid')]); |
192 | 192 | return $this; |
193 | 193 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @param Task $task |
200 | 200 | * @return $this |
201 | 201 | */ |
202 | - public function addDependency (Task $task) { |
|
202 | + public function addDependency(Task $task) { |
|
203 | 203 | return $this->addDependencies([$task]); |
204 | 204 | } |
205 | 205 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @param Task $task |
211 | 211 | * @return $this |
212 | 212 | */ |
213 | - public function addDependent (Task $task) { |
|
213 | + public function addDependent(Task $task) { |
|
214 | 214 | return $this->addDependents([$task]); |
215 | 215 | } |
216 | 216 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @param Task[] $tasks |
222 | 222 | * @return $this |
223 | 223 | */ |
224 | - public function addDependents (array $tasks) { |
|
224 | + public function addDependents(array $tasks) { |
|
225 | 225 | $this->api->post("{$this}/addDependents", ['dependents' => array_column($tasks, 'gid')]); |
226 | 226 | return $this; |
227 | 227 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @param User $user |
233 | 233 | * @return $this |
234 | 234 | */ |
235 | - public function addFollower (User $user) { |
|
235 | + public function addFollower(User $user) { |
|
236 | 236 | return $this->addFollowers([$user]); |
237 | 237 | } |
238 | 238 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @param User[] $users |
245 | 245 | * @return $this |
246 | 246 | */ |
247 | - public function addFollowers (array $users) { |
|
247 | + public function addFollowers(array $users) { |
|
248 | 248 | return $this->_addWithPost("{$this}/addFollowers", [ |
249 | 249 | 'followers' => array_column($users, 'gid') |
250 | 250 | ], 'followers', $users); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @param Tag $tag |
259 | 259 | * @return $this |
260 | 260 | */ |
261 | - public function addTag (Tag $tag) { |
|
261 | + public function addTag(Tag $tag) { |
|
262 | 262 | return $this->_addWithPost("{$this}/addTag", [ |
263 | 263 | 'tag' => $tag->getGid() |
264 | 264 | ], 'tags', [$tag]); |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * @param Section $section |
275 | 275 | * @return $this |
276 | 276 | */ |
277 | - public function addToProject (Section $section) { |
|
277 | + public function addToProject(Section $section) { |
|
278 | 278 | /** @var Membership $membership */ |
279 | 279 | $membership = $this->api->factory($this, Membership::class) |
280 | 280 | ->_set('project', $section->getProject()) |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @param string $target |
290 | 290 | * @return TaskWebhook |
291 | 291 | */ |
292 | - public function addWebhook (string $target) { |
|
292 | + public function addWebhook(string $target) { |
|
293 | 293 | /** @var TaskWebhook $webhook */ |
294 | 294 | $webhook = $this->api->factory($this, TaskWebhook::class); |
295 | 295 | return $webhook->create($this, $target); |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | /** |
299 | 299 | * @return $this |
300 | 300 | */ |
301 | - public function create () { |
|
301 | + public function create() { |
|
302 | 302 | $this->_create(); |
303 | 303 | $this->_onSave(); |
304 | 304 | return $this; |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * @param string[] $include |
315 | 315 | * @return Job |
316 | 316 | */ |
317 | - public function duplicate (string $name, array $include) { |
|
317 | + public function duplicate(string $name, array $include) { |
|
318 | 318 | /** @var array $remote */ |
319 | 319 | $remote = $this->api->post("{$this}/duplicate", [ |
320 | 320 | 'name' => $name, |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * @depends after-create |
330 | 330 | * @return Attachment[] |
331 | 331 | */ |
332 | - public function getAttachments () { |
|
332 | + public function getAttachments() { |
|
333 | 333 | return $this->api->loadAll($this, Attachment::class, "{$this}/attachments"); |
334 | 334 | } |
335 | 335 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | * @depends after-create |
338 | 338 | * @return Story[] |
339 | 339 | */ |
340 | - public function getComments () { |
|
340 | + public function getComments() { |
|
341 | 341 | return $this->selectStories(function(Story $story) { |
342 | 342 | return $story->isComment(); |
343 | 343 | }); |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | * @depends after-create |
350 | 350 | * @return Task[] |
351 | 351 | */ |
352 | - public function getDependencies () { |
|
352 | + public function getDependencies() { |
|
353 | 353 | return $this->api->loadAll($this, self::class, "{$this}/dependencies"); |
354 | 354 | } |
355 | 355 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * @depends after-create |
360 | 360 | * @return Task[] |
361 | 361 | */ |
362 | - public function getDependents () { |
|
362 | + public function getDependents() { |
|
363 | 363 | return $this->api->loadAll($this, self::class, "{$this}/dependents"); |
364 | 364 | } |
365 | 365 | |
@@ -374,21 +374,21 @@ discard block |
||
374 | 374 | * |
375 | 375 | * @return External |
376 | 376 | */ |
377 | - public function getExternal () { |
|
377 | + public function getExternal() { |
|
378 | 378 | return $this->_get('external') ?? $this->data['external'] = $this->api->factory($this, External::class); |
379 | 379 | } |
380 | 380 | |
381 | 381 | /** |
382 | 382 | * @return Project[] |
383 | 383 | */ |
384 | - public function getProjects () { |
|
384 | + public function getProjects() { |
|
385 | 385 | return array_column($this->getMemberships(), 'project'); |
386 | 386 | } |
387 | 387 | |
388 | 388 | /** |
389 | 389 | * @return Section[] |
390 | 390 | */ |
391 | - public function getSections () { |
|
391 | + public function getSections() { |
|
392 | 392 | return array_column($this->getMemberships(), 'section'); |
393 | 393 | } |
394 | 394 | |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | * @depends after-create |
397 | 397 | * @return Story[] |
398 | 398 | */ |
399 | - public function getStories () { |
|
399 | + public function getStories() { |
|
400 | 400 | return $this->api->loadAll($this, Story::class, "{$this}/stories"); |
401 | 401 | } |
402 | 402 | |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | * @depends after-create |
405 | 405 | * @return Task[] |
406 | 406 | */ |
407 | - public function getSubTasks () { |
|
407 | + public function getSubTasks() { |
|
408 | 408 | return $this->api->loadAll($this, self::class, "{$this}/subtasks"); |
409 | 409 | } |
410 | 410 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @depends after-create |
413 | 413 | * @return string |
414 | 414 | */ |
415 | - public function getUrl (): string { |
|
415 | + public function getUrl(): string { |
|
416 | 416 | return "https://app.asana.com/0/0/{$this->getGid()}"; |
417 | 417 | } |
418 | 418 | |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | * @depends after-create |
421 | 421 | * @return TaskWebhook[] |
422 | 422 | */ |
423 | - public function getWebhooks () { |
|
423 | + public function getWebhooks() { |
|
424 | 424 | return $this->api->loadAll($this, TaskWebhook::class, 'webhooks', [ |
425 | 425 | 'workspace' => $this->getWorkspace()->getGid(), |
426 | 426 | 'resource' => $this->getGid() |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * @depends after-create |
434 | 434 | * @return Story |
435 | 435 | */ |
436 | - public function newComment () { |
|
436 | + public function newComment() { |
|
437 | 437 | return $this->api->factory($this, Story::class, [ |
438 | 438 | 'resource_subtype' => Story::TYPE_COMMENT_ADDED, |
439 | 439 | 'target' => $this |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | * @depends after-create |
447 | 447 | * @return Task |
448 | 448 | */ |
449 | - public function newSubTask () { |
|
449 | + public function newSubTask() { |
|
450 | 450 | /** @var Task $sub */ |
451 | 451 | $sub = $this->api->factory($this, self::class); |
452 | 452 | return $sub->setParent($this); |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | * @param Task[] $tasks |
460 | 460 | * @return $this |
461 | 461 | */ |
462 | - public function removeDependencies (array $tasks) { |
|
462 | + public function removeDependencies(array $tasks) { |
|
463 | 463 | $this->api->post("{$this}/removeDependencies", ['dependencies' => array_column($tasks, 'gid')]); |
464 | 464 | return $this; |
465 | 465 | } |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | * @param Task $task |
472 | 472 | * @return $this |
473 | 473 | */ |
474 | - public function removeDependency (Task $task) { |
|
474 | + public function removeDependency(Task $task) { |
|
475 | 475 | return $this->removeDependencies([$task]); |
476 | 476 | } |
477 | 477 | |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | * @param Task $task |
483 | 483 | * @return $this |
484 | 484 | */ |
485 | - public function removeDependent (Task $task) { |
|
485 | + public function removeDependent(Task $task) { |
|
486 | 486 | return $this->removeDependents([$task]); |
487 | 487 | } |
488 | 488 | |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | * @param Task[] $tasks |
494 | 494 | * @return $this |
495 | 495 | */ |
496 | - public function removeDependents (array $tasks) { |
|
496 | + public function removeDependents(array $tasks) { |
|
497 | 497 | $this->api->post("{$this}/removeDependents", ['dependents' => array_column($tasks, 'gid')]); |
498 | 498 | return $this; |
499 | 499 | } |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | * @param User $user |
505 | 505 | * @return $this |
506 | 506 | */ |
507 | - public function removeFollower (User $user) { |
|
507 | + public function removeFollower(User $user) { |
|
508 | 508 | return $this->removeFollowers([$user]); |
509 | 509 | } |
510 | 510 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | * @param User[] $users |
517 | 517 | * @return $this |
518 | 518 | */ |
519 | - public function removeFollowers (array $users) { |
|
519 | + public function removeFollowers(array $users) { |
|
520 | 520 | return $this->_removeWithPost("{$this}/removeFollowers", [ |
521 | 521 | 'followers' => array_column($users, 'gid') |
522 | 522 | ], 'followers', $users); |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | * @param Project $project |
531 | 531 | * @return $this |
532 | 532 | */ |
533 | - public function removeFromProject (Project $project) { |
|
533 | + public function removeFromProject(Project $project) { |
|
534 | 534 | return $this->_removeWithPost("{$this}/removeProject", [ |
535 | 535 | 'project' => $project->getGid() |
536 | 536 | ], 'memberships', function(Membership $membership) use ($project) { |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | * @param Tag $tag |
547 | 547 | * @return $this |
548 | 548 | */ |
549 | - public function removeTag (Tag $tag) { |
|
549 | + public function removeTag(Tag $tag) { |
|
550 | 550 | return $this->_removeWithPost("{$this}/removeTag", [ |
551 | 551 | 'tag' => $tag->getGid() |
552 | 552 | ], 'tags', [$tag]); |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | * @param null|Task $parent |
560 | 560 | * @return $this |
561 | 561 | */ |
562 | - public function setParent (?self $parent) { |
|
562 | + public function setParent(?self $parent) { |
|
563 | 563 | return $this->_setWithPost("{$this}/setParent", [ |
564 | 564 | 'parent' => $parent |
565 | 565 | ], 'parent', $parent); |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | /** |
569 | 569 | * @return $this |
570 | 570 | */ |
571 | - public function update () { |
|
571 | + public function update() { |
|
572 | 572 | $this->_update(); |
573 | 573 | $this->_onSave(); |
574 | 574 | return $this; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param string $token |
44 | 44 | * @param null|Pool $pool |
45 | 45 | */ |
46 | - public function __construct (string $token, Pool $pool = null) { |
|
46 | + public function __construct(string $token, Pool $pool = null) { |
|
47 | 47 | $this->token = $token; |
48 | 48 | $this->pool = $pool ?? new Pool(); |
49 | 49 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param array $curlOpts |
57 | 57 | * @return null|array |
58 | 58 | */ |
59 | - public function call (string $method, string $path, array $curlOpts = []) { |
|
59 | + public function call(string $method, string $path, array $curlOpts = []) { |
|
60 | 60 | $this->getLog()->log(LOG_DEBUG, "{$method} {$path}", $curlOpts); |
61 | 61 | $ch = curl_init(); |
62 | 62 | curl_setopt_array($ch, [ |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param resource $ch |
79 | 79 | * @return null|array |
80 | 80 | */ |
81 | - protected function call_loop ($ch) { |
|
81 | + protected function call_loop($ch) { |
|
82 | 82 | $response = curl_exec($ch); |
83 | 83 | $info = curl_getinfo($ch); |
84 | 84 | if ($response === false) { |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | switch ($info['http_code']) { |
92 | 92 | case 200: |
93 | 93 | case 201: |
94 | - return json_decode($body, true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR); |
|
94 | + return json_decode($body, true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR); |
|
95 | 95 | case 404: |
96 | 96 | return null; |
97 | 97 | case 429: |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @param string $path |
112 | 112 | */ |
113 | - public function delete (string $path): void { |
|
113 | + public function delete(string $path): void { |
|
114 | 114 | $this->call('DELETE', $path); |
115 | 115 | } |
116 | 116 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param array $data |
125 | 125 | * @return mixed|Data|AbstractEntity |
126 | 126 | */ |
127 | - public function factory ($caller, string $class, array $data = []) { |
|
127 | + public function factory($caller, string $class, array $data = []) { |
|
128 | 128 | return new $class($caller, $data); |
129 | 129 | } |
130 | 130 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @param array $query |
136 | 136 | * @return null|array |
137 | 137 | */ |
138 | - public function get (string $path, array $query = []) { |
|
138 | + public function get(string $path, array $query = []) { |
|
139 | 139 | return $this->call('GET', $path . '?' . http_build_query($query))['data'] ?? null; |
140 | 140 | } |
141 | 141 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * @param string $gid |
146 | 146 | * @return null|Attachment |
147 | 147 | */ |
148 | - public function getAttachment (string $gid) { |
|
148 | + public function getAttachment(string $gid) { |
|
149 | 149 | return $this->load($this, Attachment::class, "attachments/{$gid}"); |
150 | 150 | } |
151 | 151 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @param string $gid |
156 | 156 | * @return null|CustomField |
157 | 157 | */ |
158 | - public function getCustomField (string $gid) { |
|
158 | + public function getCustomField(string $gid) { |
|
159 | 159 | return $this->load($this, CustomField::class, "custom_fields/{$gid}"); |
160 | 160 | } |
161 | 161 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return Workspace |
168 | 168 | */ |
169 | - public function getDefaultWorkspace () { |
|
169 | + public function getDefaultWorkspace() { |
|
170 | 170 | return $this->getMe()->getDefaultWorkspace(); |
171 | 171 | } |
172 | 172 | |
@@ -174,21 +174,21 @@ discard block |
||
174 | 174 | * @param string $gid |
175 | 175 | * @return null|Job |
176 | 176 | */ |
177 | - public function getJob (string $gid) { |
|
177 | + public function getJob(string $gid) { |
|
178 | 178 | return $this->load($this, Job::class, "jobs/{$gid}"); |
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
182 | 182 | * @return LoggerInterface |
183 | 183 | */ |
184 | - public function getLog () { |
|
184 | + public function getLog() { |
|
185 | 185 | return $this->log ?? $this->log = new NullLogger(); |
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
189 | 189 | * @return User |
190 | 190 | */ |
191 | - public function getMe () { |
|
191 | + public function getMe() { |
|
192 | 192 | return $this->getUser('me'); |
193 | 193 | } |
194 | 194 | |
@@ -196,14 +196,14 @@ discard block |
||
196 | 196 | * @param string $gid |
197 | 197 | * @return null|OrganizationExport |
198 | 198 | */ |
199 | - public function getOrganizationExport (string $gid) { |
|
199 | + public function getOrganizationExport(string $gid) { |
|
200 | 200 | return $this->load($this, OrganizationExport::class, "organization_exports/{$gid}"); |
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
204 | 204 | * @return Pool |
205 | 205 | */ |
206 | - public function getPool () { |
|
206 | + public function getPool() { |
|
207 | 207 | return $this->pool; |
208 | 208 | } |
209 | 209 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param string $gid |
214 | 214 | * @return null|Portfolio |
215 | 215 | */ |
216 | - public function getPortfolio (string $gid) { |
|
216 | + public function getPortfolio(string $gid) { |
|
217 | 217 | return $this->load($this, Portfolio::class, "portfolios/{$gid}"); |
218 | 218 | } |
219 | 219 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * @param string $gid |
224 | 224 | * @return null|Project |
225 | 225 | */ |
226 | - public function getProject (string $gid) { |
|
226 | + public function getProject(string $gid) { |
|
227 | 227 | return $this->load($this, Project::class, "projects/{$gid}"); |
228 | 228 | } |
229 | 229 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @param string $gid |
232 | 232 | * @return null|ProjectWebhook |
233 | 233 | */ |
234 | - public function getProjectWebhook (string $gid) { |
|
234 | + public function getProjectWebhook(string $gid) { |
|
235 | 235 | return $this->load($this, ProjectWebhook::class, "webhooks/{$gid}"); |
236 | 236 | } |
237 | 237 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @param string $gid |
242 | 242 | * @return null|Section |
243 | 243 | */ |
244 | - public function getSection (string $gid) { |
|
244 | + public function getSection(string $gid) { |
|
245 | 245 | return $this->load($this, Section::class, "sections/{$gid}"); |
246 | 246 | } |
247 | 247 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @param string $gid |
252 | 252 | * @return null|Story |
253 | 253 | */ |
254 | - public function getStory (string $gid) { |
|
254 | + public function getStory(string $gid) { |
|
255 | 255 | return $this->load($this, Story::class, "stories/{$gid}"); |
256 | 256 | } |
257 | 257 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | * @param string $gid |
262 | 262 | * @return null|Tag |
263 | 263 | */ |
264 | - public function getTag (string $gid) { |
|
264 | + public function getTag(string $gid) { |
|
265 | 265 | return $this->load($this, Tag::class, "tags/{$gid}"); |
266 | 266 | } |
267 | 267 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @param string $gid |
272 | 272 | * @return null|Task |
273 | 273 | */ |
274 | - public function getTask (string $gid) { |
|
274 | + public function getTask(string $gid) { |
|
275 | 275 | return $this->load($this, Task::class, "tasks/{$gid}"); |
276 | 276 | } |
277 | 277 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * @param string $gid |
282 | 282 | * @return null|TaskList |
283 | 283 | */ |
284 | - public function getTaskList (string $gid) { |
|
284 | + public function getTaskList(string $gid) { |
|
285 | 285 | return $this->load($this, TaskList::class, "user_task_lists/{$gid}"); |
286 | 286 | } |
287 | 287 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @param string $gid |
290 | 290 | * @return null|TaskWebhook |
291 | 291 | */ |
292 | - public function getTaskWebhook (string $gid) { |
|
292 | + public function getTaskWebhook(string $gid) { |
|
293 | 293 | return $this->load($this, TaskWebhook::class, "webhooks/{$gid}"); |
294 | 294 | } |
295 | 295 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @param string $gid |
300 | 300 | * @return null|Team |
301 | 301 | */ |
302 | - public function getTeam (string $gid) { |
|
302 | + public function getTeam(string $gid) { |
|
303 | 303 | return $this->load($this, Team::class, "teams/{$gid}"); |
304 | 304 | } |
305 | 305 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * @param string $gid |
310 | 310 | * @return null|User |
311 | 311 | */ |
312 | - public function getUser (string $gid) { |
|
312 | + public function getUser(string $gid) { |
|
313 | 313 | return $this->load($this, User::class, "users/{$gid}"); |
314 | 314 | } |
315 | 315 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * @param array $data |
322 | 322 | * @return Event |
323 | 323 | */ |
324 | - public function getWebhookEvent (array $data) { |
|
324 | + public function getWebhookEvent(array $data) { |
|
325 | 325 | return $this->factory($this, Event::class, $data); |
326 | 326 | } |
327 | 327 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | * @param string $gid |
332 | 332 | * @return null|Workspace |
333 | 333 | */ |
334 | - public function getWorkspace (string $gid) { |
|
334 | + public function getWorkspace(string $gid) { |
|
335 | 335 | return $this->load($this, Workspace::class, "workspaces/{$gid}"); |
336 | 336 | } |
337 | 337 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | * @param array $query |
345 | 345 | * @return null|mixed|AbstractEntity |
346 | 346 | */ |
347 | - public function load ($caller, string $class, string $path, array $query = []) { |
|
347 | + public function load($caller, string $class, string $path, array $query = []) { |
|
348 | 348 | $key = rtrim($path . '?' . http_build_query($query), '?'); |
349 | 349 | $query['opt_expand'] = 'this'; |
350 | 350 | return $this->pool->get($key, $caller, function($caller) use ($class, $path, $query) { |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | * @param array $query |
365 | 365 | * @return array|AbstractEntity[] |
366 | 366 | */ |
367 | - public function loadAll ($caller, string $class, string $path, array $query = []) { |
|
367 | + public function loadAll($caller, string $class, string $path, array $query = []) { |
|
368 | 368 | return iterator_to_array($this->loadEach(...func_get_args())); |
369 | 369 | } |
370 | 370 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | * @param array $query `limit` can exceed `100` here. |
380 | 380 | * @return Generator|AbstractEntity[] |
381 | 381 | */ |
382 | - public function loadEach ($caller, string $class, string $path, array $query = []) { |
|
382 | + public function loadEach($caller, string $class, string $path, array $query = []) { |
|
383 | 383 | $query['opt_expand'] = 'this'; |
384 | 384 | $remain = $query['limit'] ?? PHP_INT_MAX; |
385 | 385 | do { |
@@ -403,13 +403,13 @@ discard block |
||
403 | 403 | * @param array $options |
404 | 404 | * @return null|array |
405 | 405 | */ |
406 | - public function post (string $path, array $data = [], array $options = []) { |
|
406 | + public function post(string $path, array $data = [], array $options = []) { |
|
407 | 407 | return $this->call('POST', $path, [ |
408 | 408 | CURLOPT_HTTPHEADER => ['Content-Type: application/json'], |
409 | 409 | CURLOPT_POSTFIELDS => json_encode([ |
410 | 410 | 'options' => $options, |
411 | 411 | 'data' => $data |
412 | - ], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR) |
|
412 | + ], JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR) |
|
413 | 413 | ])['data'] ?? null; |
414 | 414 | } |
415 | 415 | |
@@ -421,20 +421,20 @@ discard block |
||
421 | 421 | * @param array $options |
422 | 422 | * @return null|array |
423 | 423 | */ |
424 | - public function put (string $path, array $data = [], array $options = []) { |
|
424 | + public function put(string $path, array $data = [], array $options = []) { |
|
425 | 425 | return $this->call('PUT', $path, [ |
426 | 426 | CURLOPT_HTTPHEADER => ['Content-Type: application/json'], |
427 | 427 | CURLOPT_POSTFIELDS => json_encode([ |
428 | 428 | 'options' => $options, |
429 | 429 | 'data' => $data |
430 | - ], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR) |
|
430 | + ], JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR) |
|
431 | 431 | ])['data'] ?? null; |
432 | 432 | } |
433 | 433 | |
434 | 434 | /** |
435 | 435 | * @param LoggerInterface $log |
436 | 436 | */ |
437 | - public function setLog (LoggerInterface $log) { |
|
437 | + public function setLog(LoggerInterface $log) { |
|
438 | 438 | $this->log = $log; |
439 | 439 | } |
440 | 440 | } |
441 | 441 | \ No newline at end of file |