@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @return CustomField[] |
19 | 19 | */ |
20 | - public function getCustomFields () { |
|
20 | + public function getCustomFields() { |
|
21 | 21 | return array_column($this->getCustomFieldSettings(), 'custom_field'); |
22 | 22 | } |
23 | 23 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @param callable $filter `fn( CustomField $field ): bool` |
26 | 26 | * @return CustomField[] |
27 | 27 | */ |
28 | - public function selectCustomFields (callable $filter) { |
|
28 | + public function selectCustomFields(callable $filter) { |
|
29 | 29 | return $this->_select($this->getCustomFields(), $filter); |
30 | 30 | } |
31 | 31 | } |
32 | 32 | \ No newline at end of file |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | 'memberships' => 'memberships.(project|section)' |
102 | 102 | ]; |
103 | 103 | |
104 | - final public function __toString (): string { |
|
104 | + final public function __toString(): string { |
|
105 | 105 | return "tasks/{$this->getGid()}"; |
106 | 106 | } |
107 | 107 | |
108 | - final protected function _getDir (): string { |
|
108 | + final protected function _getDir(): string { |
|
109 | 109 | return 'tasks'; |
110 | 110 | } |
111 | 111 | |
112 | - protected function _onSave (): void { |
|
112 | + protected function _onSave(): void { |
|
113 | 113 | // use isset() to avoid has() fetch. |
114 | 114 | if (isset($this->data['custom_fields'])) { |
115 | 115 | $this->getCustomFields()->diff = []; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
122 | - protected function _setData (array $data): void { |
|
122 | + protected function _setData(array $data): void { |
|
123 | 123 | // hearts were deprecated for likes |
124 | 124 | unset($data['hearted'], $data['hearts'], $data['num_hearts']); |
125 | 125 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @param string $file |
140 | 140 | * @return Attachment |
141 | 141 | */ |
142 | - public function addAttachment (string $file) { |
|
142 | + public function addAttachment(string $file) { |
|
143 | 143 | /** @var Attachment $attachment */ |
144 | 144 | $attachment = $this->api->factory($this, Attachment::class, ['parent' => $this]); |
145 | 145 | return $attachment->upload($file); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @param string $text |
152 | 152 | * @return Story |
153 | 153 | */ |
154 | - public function addComment (string $text) { |
|
154 | + public function addComment(string $text) { |
|
155 | 155 | return $this->newComment()->setText($text)->create(); |
156 | 156 | } |
157 | 157 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @param Task[] $tasks |
163 | 163 | * @return $this |
164 | 164 | */ |
165 | - public function addDependencies (array $tasks) { |
|
165 | + public function addDependencies(array $tasks) { |
|
166 | 166 | $this->api->post("{$this}/addDependencies", ['dependents' => array_column($tasks, 'gid')]); |
167 | 167 | return $this; |
168 | 168 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param Task $task |
175 | 175 | * @return $this |
176 | 176 | */ |
177 | - public function addDependency (Task $task) { |
|
177 | + public function addDependency(Task $task) { |
|
178 | 178 | return $this->addDependencies([$task]); |
179 | 179 | } |
180 | 180 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @param Task $task |
186 | 186 | * @return $this |
187 | 187 | */ |
188 | - public function addDependent (Task $task) { |
|
188 | + public function addDependent(Task $task) { |
|
189 | 189 | return $this->addDependents([$task]); |
190 | 190 | } |
191 | 191 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * @param Task[] $tasks |
197 | 197 | * @return $this |
198 | 198 | */ |
199 | - public function addDependents (array $tasks) { |
|
199 | + public function addDependents(array $tasks) { |
|
200 | 200 | $this->api->post("{$this}/addDependents", ['dependents' => array_column($tasks, 'gid')]); |
201 | 201 | return $this; |
202 | 202 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @param User $user |
208 | 208 | * @return $this |
209 | 209 | */ |
210 | - public function addFollower (User $user) { |
|
210 | + public function addFollower(User $user) { |
|
211 | 211 | return $this->addFollowers([$user]); |
212 | 212 | } |
213 | 213 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @param User[] $users |
220 | 220 | * @return $this |
221 | 221 | */ |
222 | - public function addFollowers (array $users) { |
|
222 | + public function addFollowers(array $users) { |
|
223 | 223 | return $this->_addWithPost("{$this}/addFollowers", [ |
224 | 224 | 'followers' => array_column($users, 'gid') |
225 | 225 | ], 'followers', $users); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @param Tag $tag |
234 | 234 | * @return $this |
235 | 235 | */ |
236 | - public function addTag (Tag $tag) { |
|
236 | + public function addTag(Tag $tag) { |
|
237 | 237 | return $this->_addWithPost("{$this}/addTag", [ |
238 | 238 | 'tag' => $tag->getGid() |
239 | 239 | ], 'tags', [$tag]); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * @param Section $section |
250 | 250 | * @return $this |
251 | 251 | */ |
252 | - public function addToProject (Section $section) { |
|
252 | + public function addToProject(Section $section) { |
|
253 | 253 | /** @var Membership $membership */ |
254 | 254 | $membership = $this->api->factory($this, Membership::class) |
255 | 255 | ->_set('project', $section->getProject()) |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * @param string $target |
265 | 265 | * @return TaskWebhook |
266 | 266 | */ |
267 | - public function addWebhook (string $target) { |
|
267 | + public function addWebhook(string $target) { |
|
268 | 268 | /** @var TaskWebhook $webhook */ |
269 | 269 | $webhook = $this->api->factory($this, TaskWebhook::class); |
270 | 270 | return $webhook->create($this, $target); |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | /** |
274 | 274 | * @return $this |
275 | 275 | */ |
276 | - public function create () { |
|
276 | + public function create() { |
|
277 | 277 | $this->_create(); |
278 | 278 | $this->_onSave(); |
279 | 279 | return $this; |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @param string[] $include |
290 | 290 | * @return Job |
291 | 291 | */ |
292 | - public function duplicate (string $name, array $include) { |
|
292 | + public function duplicate(string $name, array $include) { |
|
293 | 293 | /** @var array $remote */ |
294 | 294 | $remote = $this->api->post("{$this}/duplicate", [ |
295 | 295 | 'name' => $name, |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * @depends after-create |
305 | 305 | * @return Attachment[] |
306 | 306 | */ |
307 | - public function getAttachments () { |
|
307 | + public function getAttachments() { |
|
308 | 308 | return $this->api->loadAll($this, Attachment::class, "{$this}/attachments"); |
309 | 309 | } |
310 | 310 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * @depends after-create |
315 | 315 | * @return Story[] |
316 | 316 | */ |
317 | - public function getComments () { |
|
317 | + public function getComments() { |
|
318 | 318 | return $this->selectStories(function(Story $story) { |
319 | 319 | return $story->isComment(); |
320 | 320 | }); |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @depends after-create |
327 | 327 | * @return Task[] |
328 | 328 | */ |
329 | - public function getDependencies () { |
|
329 | + public function getDependencies() { |
|
330 | 330 | return $this->api->loadAll($this, self::class, "{$this}/dependencies"); |
331 | 331 | } |
332 | 332 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | * @depends after-create |
337 | 337 | * @return Task[] |
338 | 338 | */ |
339 | - public function getDependents () { |
|
339 | + public function getDependents() { |
|
340 | 340 | return $this->api->loadAll($this, self::class, "{$this}/dependents"); |
341 | 341 | } |
342 | 342 | |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | * @param null|string $token |
348 | 348 | * @return Event[] |
349 | 349 | */ |
350 | - public function getEvents (&$token) { |
|
350 | + public function getEvents(&$token) { |
|
351 | 351 | return $this->api->sync($this->getGid(), $token); |
352 | 352 | } |
353 | 353 | |
@@ -359,21 +359,21 @@ discard block |
||
359 | 359 | * |
360 | 360 | * @return External |
361 | 361 | */ |
362 | - public function getExternal () { |
|
362 | + public function getExternal() { |
|
363 | 363 | return $this->_get('external') ?? $this->data['external'] = $this->api->factory($this, External::class); |
364 | 364 | } |
365 | 365 | |
366 | 366 | /** |
367 | 367 | * @return Project[] |
368 | 368 | */ |
369 | - public function getProjects () { |
|
369 | + public function getProjects() { |
|
370 | 370 | return array_column($this->getMemberships(), 'project'); |
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
374 | 374 | * @return Section[] |
375 | 375 | */ |
376 | - public function getSections () { |
|
376 | + public function getSections() { |
|
377 | 377 | return array_column($this->getMemberships(), 'section'); |
378 | 378 | } |
379 | 379 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | * @depends after-create |
384 | 384 | * @return Story[] |
385 | 385 | */ |
386 | - public function getStories () { |
|
386 | + public function getStories() { |
|
387 | 387 | return $this->api->loadAll($this, Story::class, "{$this}/stories"); |
388 | 388 | } |
389 | 389 | |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | * @depends after-create |
394 | 394 | * @return Task[] |
395 | 395 | */ |
396 | - public function getSubTasks () { |
|
396 | + public function getSubTasks() { |
|
397 | 397 | return $this->api->loadAll($this, self::class, "{$this}/subtasks"); |
398 | 398 | } |
399 | 399 | |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | * @depends after-create |
404 | 404 | * @return string |
405 | 405 | */ |
406 | - public function getUrl (): string { |
|
406 | + public function getUrl(): string { |
|
407 | 407 | return "https://app.asana.com/0/0/{$this->getGid()}"; |
408 | 408 | } |
409 | 409 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * @depends after-create |
414 | 414 | * @return TaskWebhook[] |
415 | 415 | */ |
416 | - public function getWebhooks () { |
|
416 | + public function getWebhooks() { |
|
417 | 417 | return $this->api->loadAll($this, TaskWebhook::class, 'webhooks', [ |
418 | 418 | 'workspace' => $this->getWorkspace()->getGid(), |
419 | 419 | 'resource' => $this->getGid() |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | /** |
424 | 424 | * @return bool |
425 | 425 | */ |
426 | - public function isRenderedAsSeparator (): bool { |
|
426 | + public function isRenderedAsSeparator(): bool { |
|
427 | 427 | return $this->_is('is_rendered_as_separator'); |
428 | 428 | } |
429 | 429 | |
@@ -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]); |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | * @param callable $filter `fn( Attachment $attachment): bool` |
557 | 557 | * @return Attachment[] |
558 | 558 | */ |
559 | - public function selectAttachments (callable $filter) { |
|
559 | + public function selectAttachments(callable $filter) { |
|
560 | 560 | return $this->_select($this->getAttachments(), $filter); |
561 | 561 | } |
562 | 562 | |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | * @param callable $filter `fn( Story $comment ): bool` |
565 | 565 | * @return Story[] |
566 | 566 | */ |
567 | - public function selectComments (callable $filter) { |
|
567 | + public function selectComments(callable $filter) { |
|
568 | 568 | return $this->_select($this->getComments(), $filter); |
569 | 569 | } |
570 | 570 | |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | * @param callable $filter `fn( Task $dependency ): bool` |
573 | 573 | * @return Task[] |
574 | 574 | */ |
575 | - public function selectDependencies (callable $filter) { |
|
575 | + public function selectDependencies(callable $filter) { |
|
576 | 576 | return $this->_select($this->getDependencies(), $filter); |
577 | 577 | } |
578 | 578 | |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | * @param callable $filter `fn( Task $dependent ): bool` |
581 | 581 | * @return Task[] |
582 | 582 | */ |
583 | - public function selectDependents (callable $filter) { |
|
583 | + public function selectDependents(callable $filter) { |
|
584 | 584 | return $this->_select($this->getDependents(), $filter); |
585 | 585 | } |
586 | 586 | |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | * @param callable $filter `fn( Project $project ): bool` |
589 | 589 | * @return Project[] |
590 | 590 | */ |
591 | - public function selectProjects (callable $filter) { |
|
591 | + public function selectProjects(callable $filter) { |
|
592 | 592 | return $this->_select($this->getProjects(), $filter); |
593 | 593 | } |
594 | 594 | |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | * @param callable $filter `fn( Story $story ): bool` |
597 | 597 | * @return Story[] |
598 | 598 | */ |
599 | - public function selectStories (callable $filter) { |
|
599 | + public function selectStories(callable $filter) { |
|
600 | 600 | return $this->_select($this->getStories(), $filter); |
601 | 601 | } |
602 | 602 | |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | * @param callable $filter `fn( Task $subtask ): bool` |
605 | 605 | * @return Task[] |
606 | 606 | */ |
607 | - public function selectSubTasks (callable $filter) { |
|
607 | + public function selectSubTasks(callable $filter) { |
|
608 | 608 | return $this->_select($this->getSubTasks(), $filter); |
609 | 609 | } |
610 | 610 | |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | * @param null|string|DateTimeInterface $date |
613 | 613 | * @return Task |
614 | 614 | */ |
615 | - public function setDueOn ($date) { |
|
615 | + public function setDueOn($date) { |
|
616 | 616 | if ($date instanceof DateTimeInterface) { |
617 | 617 | $date = $date->format('Y-m-d'); |
618 | 618 | } |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | * @param null|Task $parent |
627 | 627 | * @return $this |
628 | 628 | */ |
629 | - public function setParent (?self $parent) { |
|
629 | + public function setParent(?self $parent) { |
|
630 | 630 | return $this->_setWithPost("{$this}/setParent", [ |
631 | 631 | 'parent' => $parent |
632 | 632 | ], 'parent', $parent); |
@@ -636,14 +636,14 @@ discard block |
||
636 | 636 | * @param bool $flag |
637 | 637 | * @return $this |
638 | 638 | */ |
639 | - public function setRenderedAsSeparator (bool $flag) { |
|
639 | + public function setRenderedAsSeparator(bool $flag) { |
|
640 | 640 | return $this->_set('is_rendered_as_separator', $flag); |
641 | 641 | } |
642 | 642 | |
643 | 643 | /** |
644 | 644 | * @return $this |
645 | 645 | */ |
646 | - public function update () { |
|
646 | + public function update() { |
|
647 | 647 | $this->_update(); |
648 | 648 | $this->_onSave(); |
649 | 649 | return $this; |
@@ -17,7 +17,7 @@ |
||
17 | 17 | * @param Workspace $workspace |
18 | 18 | * @return $this |
19 | 19 | */ |
20 | - public function setWorkspace (Workspace $workspace) { |
|
20 | + public function setWorkspace(Workspace $workspace) { |
|
21 | 21 | return $this->_set('workspace', $workspace); |
22 | 22 | } |
23 | 23 | } |
24 | 24 | \ No newline at end of file |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @param PSR16 $psr |
35 | 35 | */ |
36 | - public function __construct (PSR16 $psr) { |
|
36 | + public function __construct(PSR16 $psr) { |
|
37 | 37 | $this->psr = $psr; |
38 | 38 | } |
39 | 39 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param AbstractEntity $entity |
42 | 42 | * @throws CacheException |
43 | 43 | */ |
44 | - protected function _add (AbstractEntity $entity): void { |
|
44 | + protected function _add(AbstractEntity $entity): void { |
|
45 | 45 | $this->psr->set("asana/{$entity->getGid()}", $entity, $this->_getTtl($entity)); |
46 | 46 | parent::_add($entity); |
47 | 47 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @param string[] $keys |
52 | 52 | * @throws CacheException |
53 | 53 | */ |
54 | - protected function _addKeys (AbstractEntity $entity, ...$keys): void { |
|
54 | + protected function _addKeys(AbstractEntity $entity, ...$keys): void { |
|
55 | 55 | $gid = $entity->getGid(); |
56 | 56 | $ttl = $this->_getTtl($entity); |
57 | 57 | foreach ($keys as $key) { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return null|AbstractEntity |
69 | 69 | * @throws CacheException |
70 | 70 | */ |
71 | - protected function _get (string $key, $caller) { |
|
71 | + protected function _get(string $key, $caller) { |
|
72 | 72 | if (!$entity = parent::_get($key, $caller) and $entity = $this->psr->get("asana/{$key}")) { |
73 | 73 | if (is_string($entity)) { // gid ref |
74 | 74 | if (!$entity = $this->_get($entity, $caller)) { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | return $entity; |
84 | 84 | } |
85 | 85 | |
86 | - protected function _getTtl (AbstractEntity $entity): int { |
|
86 | + protected function _getTtl(AbstractEntity $entity): int { |
|
87 | 87 | if ($entity instanceof ImmutableInterface) { |
88 | 88 | return strtotime('tomorrow') - time(); |
89 | 89 | } |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | * @return bool |
96 | 96 | * @throws CacheException |
97 | 97 | */ |
98 | - protected function _has (string $key): bool { |
|
98 | + protected function _has(string $key): bool { |
|
99 | 99 | return parent::_has($key) or $this->psr->has("asana/{$key}"); |
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
103 | 103 | * @return int |
104 | 104 | */ |
105 | - public function getTtl (): int { |
|
105 | + public function getTtl(): int { |
|
106 | 106 | return $this->ttl; |
107 | 107 | } |
108 | 108 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @param string[] $keys |
111 | 111 | * @throws CacheException |
112 | 112 | */ |
113 | - public function remove (array $keys): void { |
|
113 | + public function remove(array $keys): void { |
|
114 | 114 | parent::remove($keys); |
115 | 115 | foreach ($keys as $key) { |
116 | 116 | $this->psr->delete("asana/{$key}"); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @param int $ttl |
122 | 122 | * @return $this |
123 | 123 | */ |
124 | - public function setTtl (int $ttl) { |
|
124 | + public function setTtl(int $ttl) { |
|
125 | 125 | $this->ttl = $ttl; |
126 | 126 | return $this; |
127 | 127 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | 'workspace' => Workspace::class |
32 | 32 | ]; |
33 | 33 | |
34 | - final public function __toString (): string { |
|
34 | + final public function __toString(): string { |
|
35 | 35 | return "user_task_lists/{$this->getGid()}"; |
36 | 36 | } |
37 | 37 | |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | * @param array $filter |
40 | 40 | * @return Traversable|Task[] |
41 | 41 | */ |
42 | - public function getIterator (array $filter = Task::FILTER_INCOMPLETE) { |
|
42 | + public function getIterator(array $filter = Task::FILTER_INCOMPLETE) { |
|
43 | 43 | return $this->api->loadEach($this, Task::class, "{$this}/tasks", $filter); |
44 | 44 | } |
45 | 45 | |
46 | - public function getPoolKeys () { |
|
46 | + public function getPoolKeys() { |
|
47 | 47 | $keys = parent::getPoolKeys(); |
48 | 48 | |
49 | 49 | /** @see User::getTaskList() */ |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param array $filter |
61 | 61 | * @return Task[] |
62 | 62 | */ |
63 | - public function getTasks (array $filter = Task::FILTER_INCOMPLETE) { |
|
63 | + public function getTasks(array $filter = Task::FILTER_INCOMPLETE) { |
|
64 | 64 | return iterator_to_array($this->getIterator($filter)); |
65 | 65 | } |
66 | 66 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param array $apiFilter Given to the API to reduce network load. |
70 | 70 | * @return Task[] |
71 | 71 | */ |
72 | - public function selectTasks (callable $filter, array $apiFilter) { |
|
72 | + public function selectTasks(callable $filter, array $apiFilter) { |
|
73 | 73 | return $this->_select($this->getIterator($apiFilter), $filter); |
74 | 74 | } |
75 | 75 | } |
76 | 76 | \ No newline at end of file |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | 'workspace' => Workspace::class |
35 | 35 | ]; |
36 | 36 | |
37 | - final public function __toString (): string { |
|
37 | + final public function __toString(): string { |
|
38 | 38 | return "tags/{$this->getGid()}"; |
39 | 39 | } |
40 | 40 | |
41 | - final protected function _getDir (): string { |
|
41 | + final protected function _getDir(): string { |
|
42 | 42 | return 'tags'; |
43 | 43 | } |
44 | 44 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param array $filter |
47 | 47 | * @return Traversable|Task[] |
48 | 48 | */ |
49 | - public function getIterator (array $filter = Task::FILTER_INCOMPLETE) { |
|
49 | + public function getIterator(array $filter = Task::FILTER_INCOMPLETE) { |
|
50 | 50 | return $this->api->loadEach($this, Task::class, "{$this}/tasks", $filter); |
51 | 51 | } |
52 | 52 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param array $filter |
55 | 55 | * @return Task[] |
56 | 56 | */ |
57 | - public function getTasks (array $filter = Task::FILTER_INCOMPLETE) { |
|
57 | + public function getTasks(array $filter = Task::FILTER_INCOMPLETE) { |
|
58 | 58 | return iterator_to_array($this->getIterator($filter)); |
59 | 59 | } |
60 | 60 | } |
61 | 61 | \ No newline at end of file |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | */ |
41 | 41 | class Event extends Data { |
42 | 42 | |
43 | - const ACTION_CHANGED = 'changed'; // no parent |
|
44 | - const ACTION_ADDED = 'added'; // relational, no change |
|
45 | - const ACTION_REMOVED = 'removed'; // relational, no change |
|
46 | - const ACTION_DELETED = 'deleted'; // no parent or change |
|
47 | - const ACTION_UNDELETED = 'undeleted'; // no parent or change |
|
43 | + const ACTION_CHANGED = 'changed'; // no parent |
|
44 | + const ACTION_ADDED = 'added'; // relational, no change |
|
45 | + const ACTION_REMOVED = 'removed'; // relational, no change |
|
46 | + const ACTION_DELETED = 'deleted'; // no parent or change |
|
47 | + const ACTION_UNDELETED = 'undeleted'; // no parent or change |
|
48 | 48 | |
49 | 49 | const GRAPH = [ |
50 | 50 | User::TYPE => User::class, |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | 'user' => User::class |
63 | 63 | ]; |
64 | 64 | |
65 | - protected function _setData (array $data): void { |
|
65 | + protected function _setData(array $data): void { |
|
66 | 66 | if (isset($data['parent'])) { |
67 | 67 | $type = $data['parent']['resource_type']; |
68 | 68 | $data['parent'] = $this->_hydrate(static::GRAPH[$type], $data['parent']); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @return null|Project|Section|Task |
81 | 81 | */ |
82 | - public function getParent () { |
|
82 | + public function getParent() { |
|
83 | 83 | return $this->data['parent'] ?? null; |
84 | 84 | } |
85 | 85 | |
@@ -88,42 +88,42 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return User|Project|Section|Task|CustomField|Attachment|Story|Like |
90 | 90 | */ |
91 | - public function getResource () { |
|
91 | + public function getResource() { |
|
92 | 92 | return $this->data['resource']; |
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
96 | 96 | * @return bool |
97 | 97 | */ |
98 | - final public function wasAddition (): bool { |
|
98 | + final public function wasAddition(): bool { |
|
99 | 99 | return $this->getAction() === self::ACTION_ADDED; |
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
103 | 103 | * @return bool |
104 | 104 | */ |
105 | - final public function wasChange (): bool { |
|
105 | + final public function wasChange(): bool { |
|
106 | 106 | return $this->getAction() === self::ACTION_CHANGED; |
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
110 | 110 | * @return bool |
111 | 111 | */ |
112 | - final public function wasDeletion (): bool { |
|
112 | + final public function wasDeletion(): bool { |
|
113 | 113 | return $this->getAction() === self::ACTION_DELETED; |
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
117 | 117 | * @return bool |
118 | 118 | */ |
119 | - final public function wasRemoval (): bool { |
|
119 | + final public function wasRemoval(): bool { |
|
120 | 120 | return $this->getAction() === self::ACTION_REMOVED; |
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
124 | 124 | * @return bool |
125 | 125 | */ |
126 | - final public function wasUndeletion (): bool { |
|
126 | + final public function wasUndeletion(): bool { |
|
127 | 127 | return $this->getAction() === self::ACTION_UNDELETED; |
128 | 128 | } |
129 | 129 |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | 'project' => Project::class |
31 | 31 | ]; |
32 | 32 | |
33 | - final public function __toString (): string { |
|
33 | + final public function __toString(): string { |
|
34 | 34 | return "sections/{$this->getGid()}"; |
35 | 35 | } |
36 | 36 | |
37 | - final protected function _getDir (): string { |
|
37 | + final protected function _getDir(): string { |
|
38 | 38 | return "{$this->getProject()}/sections"; |
39 | 39 | } |
40 | 40 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param array $filter |
43 | 43 | * @return Traversable|Task[] |
44 | 44 | */ |
45 | - public function getIterator (array $filter = Task::FILTER_INCOMPLETE) { |
|
45 | + public function getIterator(array $filter = Task::FILTER_INCOMPLETE) { |
|
46 | 46 | $filter['section'] = $this->getGid(); |
47 | 47 | return $this->api->loadEach($this, Task::class, 'tasks', $filter); |
48 | 48 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @param array $filter |
52 | 52 | * @return Task[] |
53 | 53 | */ |
54 | - public function getTasks (array $filter = Task::FILTER_INCOMPLETE) { |
|
54 | + public function getTasks(array $filter = Task::FILTER_INCOMPLETE) { |
|
55 | 55 | return iterator_to_array($this->getIterator($filter)); |
56 | 56 | } |
57 | 57 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @depends after-create |
62 | 62 | * @return Task |
63 | 63 | */ |
64 | - public function newTask () { |
|
64 | + public function newTask() { |
|
65 | 65 | /** @var Task $task */ |
66 | 66 | $task = $this->api->factory($this, Task::class); |
67 | 67 | return $task->addToProject($this); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | protected $valueKey; |
30 | 30 | |
31 | - protected function _setData (array $data): void { |
|
31 | + protected function _setData(array $data): void { |
|
32 | 32 | $this->valueKey = [ |
33 | 33 | 'added' => 'added_value', |
34 | 34 | 'removed' => 'removed_value', |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return null|User|Project|Section|Task|FieldEntry|Attachment|Story|Like |
56 | 56 | */ |
57 | - public function getPayload () { |
|
57 | + public function getPayload() { |
|
58 | 58 | return $this->data[$this->valueKey]; |
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @return bool |
63 | 63 | */ |
64 | - final public function hasPayload (): bool { |
|
64 | + final public function hasPayload(): bool { |
|
65 | 65 | return isset($this->data[$this->valueKey]); |
66 | 66 | } |
67 | 67 |