@@ -98,15 +98,15 @@ discard block |
||
| 98 | 98 | 'memberships' => 'memberships.(project|section)' |
| 99 | 99 | ]; |
| 100 | 100 | |
| 101 | - final public function __toString (): string { |
|
| 101 | + final public function __toString(): string { |
|
| 102 | 102 | return "tasks/{$this->getGid()}"; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - final protected function _getDir (): string { |
|
| 105 | + final protected function _getDir(): string { |
|
| 106 | 106 | return 'tasks'; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - protected function _save (string $dir = null) { |
|
| 109 | + protected function _save(string $dir = null) { |
|
| 110 | 110 | parent::_save($dir); |
| 111 | 111 | // use isset() to avoid has() fetch. |
| 112 | 112 | if (isset($this->data['custom_fields'])) { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | return $this; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - protected function _setData (array $data): void { |
|
| 121 | + protected function _setData(array $data): void { |
|
| 122 | 122 | // hearts were deprecated for likes |
| 123 | 123 | unset($data['hearted'], $data['hearts'], $data['num_hearts']); |
| 124 | 124 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @param string $file |
| 139 | 139 | * @return Attachment |
| 140 | 140 | */ |
| 141 | - public function addAttachment (string $file) { |
|
| 141 | + public function addAttachment(string $file) { |
|
| 142 | 142 | /** @var Attachment $attachment */ |
| 143 | 143 | $attachment = $this->api->factory($this, Attachment::class, ['parent' => $this]); |
| 144 | 144 | return $attachment->upload($file); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * @param string $text |
| 151 | 151 | * @return Story |
| 152 | 152 | */ |
| 153 | - public function addComment (string $text) { |
|
| 153 | + public function addComment(string $text) { |
|
| 154 | 154 | return $this->newComment()->setText($text)->create(); |
| 155 | 155 | } |
| 156 | 156 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @param Task[] $tasks |
| 162 | 162 | * @return $this |
| 163 | 163 | */ |
| 164 | - public function addDependencies (array $tasks) { |
|
| 164 | + public function addDependencies(array $tasks) { |
|
| 165 | 165 | $this->api->post("{$this}/addDependencies", ['dependents' => array_column($tasks, 'gid')]); |
| 166 | 166 | return $this; |
| 167 | 167 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | * @param Task $task |
| 174 | 174 | * @return $this |
| 175 | 175 | */ |
| 176 | - public function addDependency (Task $task) { |
|
| 176 | + public function addDependency(Task $task) { |
|
| 177 | 177 | return $this->addDependencies([$task]); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | * @param Task $task |
| 185 | 185 | * @return $this |
| 186 | 186 | */ |
| 187 | - public function addDependent (Task $task) { |
|
| 187 | + public function addDependent(Task $task) { |
|
| 188 | 188 | return $this->addDependents([$task]); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * @param Task[] $tasks |
| 196 | 196 | * @return $this |
| 197 | 197 | */ |
| 198 | - public function addDependents (array $tasks) { |
|
| 198 | + public function addDependents(array $tasks) { |
|
| 199 | 199 | $this->api->post("{$this}/addDependents", ['dependents' => array_column($tasks, 'gid')]); |
| 200 | 200 | return $this; |
| 201 | 201 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * @param User $user |
| 207 | 207 | * @return $this |
| 208 | 208 | */ |
| 209 | - public function addFollower (User $user) { |
|
| 209 | + public function addFollower(User $user) { |
|
| 210 | 210 | return $this->addFollowers([$user]); |
| 211 | 211 | } |
| 212 | 212 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * @param User[] $users |
| 219 | 219 | * @return $this |
| 220 | 220 | */ |
| 221 | - public function addFollowers (array $users) { |
|
| 221 | + public function addFollowers(array $users) { |
|
| 222 | 222 | return $this->_addWithPost("{$this}/addFollowers", [ |
| 223 | 223 | 'followers' => array_column($users, 'gid') |
| 224 | 224 | ], 'followers', $users); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * @param Tag $tag |
| 233 | 233 | * @return $this |
| 234 | 234 | */ |
| 235 | - public function addTag (Tag $tag) { |
|
| 235 | + public function addTag(Tag $tag) { |
|
| 236 | 236 | return $this->_addWithPost("{$this}/addTag", [ |
| 237 | 237 | 'tag' => $tag->getGid() |
| 238 | 238 | ], 'tags', [$tag]); |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | * @param Section $section |
| 249 | 249 | * @return $this |
| 250 | 250 | */ |
| 251 | - public function addToProject (Section $section) { |
|
| 251 | + public function addToProject(Section $section) { |
|
| 252 | 252 | /** @var Membership $membership */ |
| 253 | 253 | $membership = $this->api->factory($this, Membership::class) |
| 254 | 254 | ->_set('project', $section->getProject()) |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | * @param string $target |
| 264 | 264 | * @return TaskWebhook |
| 265 | 265 | */ |
| 266 | - public function addWebhook (string $target) { |
|
| 266 | + public function addWebhook(string $target) { |
|
| 267 | 267 | /** @var TaskWebhook $webhook */ |
| 268 | 268 | $webhook = $this->api->factory($this, TaskWebhook::class); |
| 269 | 269 | return $webhook->create($this, $target); |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | * @param string[] $include |
| 280 | 280 | * @return Job |
| 281 | 281 | */ |
| 282 | - public function duplicate (string $name, array $include) { |
|
| 282 | + public function duplicate(string $name, array $include) { |
|
| 283 | 283 | /** @var array $remote */ |
| 284 | 284 | $remote = $this->api->post("{$this}/duplicate", [ |
| 285 | 285 | 'name' => $name, |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | * @depends after-create |
| 295 | 295 | * @return Attachment[] |
| 296 | 296 | */ |
| 297 | - public function getAttachments () { |
|
| 297 | + public function getAttachments() { |
|
| 298 | 298 | return $this->api->loadAll($this, Attachment::class, "{$this}/attachments"); |
| 299 | 299 | } |
| 300 | 300 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | * @depends after-create |
| 305 | 305 | * @return Story[] |
| 306 | 306 | */ |
| 307 | - public function getComments () { |
|
| 307 | + public function getComments() { |
|
| 308 | 308 | return $this->selectStories(function(Story $story) { |
| 309 | 309 | return $story->isComment(); |
| 310 | 310 | }); |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | * @depends after-create |
| 317 | 317 | * @return Task[] |
| 318 | 318 | */ |
| 319 | - public function getDependencies () { |
|
| 319 | + public function getDependencies() { |
|
| 320 | 320 | return $this->api->loadAll($this, self::class, "{$this}/dependencies"); |
| 321 | 321 | } |
| 322 | 322 | |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | * @depends after-create |
| 327 | 327 | * @return Task[] |
| 328 | 328 | */ |
| 329 | - public function getDependents () { |
|
| 329 | + public function getDependents() { |
|
| 330 | 330 | return $this->api->loadAll($this, self::class, "{$this}/dependents"); |
| 331 | 331 | } |
| 332 | 332 | |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | * @param null|string $token |
| 338 | 338 | * @return Event[] |
| 339 | 339 | */ |
| 340 | - public function getEvents (&$token) { |
|
| 340 | + public function getEvents(&$token) { |
|
| 341 | 341 | return $this->api->sync($this->getGid(), $token); |
| 342 | 342 | } |
| 343 | 343 | |
@@ -349,21 +349,21 @@ discard block |
||
| 349 | 349 | * |
| 350 | 350 | * @return External |
| 351 | 351 | */ |
| 352 | - public function getExternal () { |
|
| 352 | + public function getExternal() { |
|
| 353 | 353 | return $this->_get('external') ?? $this->data['external'] = $this->api->factory($this, External::class); |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | /** |
| 357 | 357 | * @return Project[] |
| 358 | 358 | */ |
| 359 | - public function getProjects () { |
|
| 359 | + public function getProjects() { |
|
| 360 | 360 | return array_column($this->getMemberships(), 'project'); |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
| 364 | 364 | * @return Section[] |
| 365 | 365 | */ |
| 366 | - public function getSections () { |
|
| 366 | + public function getSections() { |
|
| 367 | 367 | return array_column($this->getMemberships(), 'section'); |
| 368 | 368 | } |
| 369 | 369 | |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | * @depends after-create |
| 374 | 374 | * @return Story[] |
| 375 | 375 | */ |
| 376 | - public function getStories () { |
|
| 376 | + public function getStories() { |
|
| 377 | 377 | return $this->api->loadAll($this, Story::class, "{$this}/stories"); |
| 378 | 378 | } |
| 379 | 379 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | * @depends after-create |
| 384 | 384 | * @return Task[] |
| 385 | 385 | */ |
| 386 | - public function getSubTasks () { |
|
| 386 | + public function getSubTasks() { |
|
| 387 | 387 | return $this->api->loadAll($this, self::class, "{$this}/subtasks"); |
| 388 | 388 | } |
| 389 | 389 | |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | * @depends after-create |
| 394 | 394 | * @return string |
| 395 | 395 | */ |
| 396 | - public function getUrl (): string { |
|
| 396 | + public function getUrl(): string { |
|
| 397 | 397 | return "https://app.asana.com/0/0/{$this->getGid()}"; |
| 398 | 398 | } |
| 399 | 399 | |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | * @depends after-create |
| 404 | 404 | * @return TaskWebhook[] |
| 405 | 405 | */ |
| 406 | - public function getWebhooks () { |
|
| 406 | + public function getWebhooks() { |
|
| 407 | 407 | return $this->api->loadAll($this, TaskWebhook::class, 'webhooks', [ |
| 408 | 408 | 'workspace' => $this->getWorkspace()->getGid(), |
| 409 | 409 | 'resource' => $this->getGid() |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | /** |
| 414 | 414 | * @return bool |
| 415 | 415 | */ |
| 416 | - public function isRenderedAsSeparator (): bool { |
|
| 416 | + public function isRenderedAsSeparator(): bool { |
|
| 417 | 417 | return $this->_is('is_rendered_as_separator'); |
| 418 | 418 | } |
| 419 | 419 | |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | * @depends after-create |
| 424 | 424 | * @return Story |
| 425 | 425 | */ |
| 426 | - public function newComment () { |
|
| 426 | + public function newComment() { |
|
| 427 | 427 | return $this->api->factory($this, Story::class, [ |
| 428 | 428 | 'resource_subtype' => Story::TYPE_COMMENT_ADDED, |
| 429 | 429 | 'target' => $this |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | * @depends after-create |
| 437 | 437 | * @return Task |
| 438 | 438 | */ |
| 439 | - public function newSubTask () { |
|
| 439 | + public function newSubTask() { |
|
| 440 | 440 | /** @var Task $sub */ |
| 441 | 441 | $sub = $this->api->factory($this, self::class); |
| 442 | 442 | return $sub->setParent($this); |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | * @param Task[] $tasks |
| 450 | 450 | * @return $this |
| 451 | 451 | */ |
| 452 | - public function removeDependencies (array $tasks) { |
|
| 452 | + public function removeDependencies(array $tasks) { |
|
| 453 | 453 | $this->api->post("{$this}/removeDependencies", ['dependencies' => array_column($tasks, 'gid')]); |
| 454 | 454 | return $this; |
| 455 | 455 | } |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | * @param Task $task |
| 462 | 462 | * @return $this |
| 463 | 463 | */ |
| 464 | - public function removeDependency (Task $task) { |
|
| 464 | + public function removeDependency(Task $task) { |
|
| 465 | 465 | return $this->removeDependencies([$task]); |
| 466 | 466 | } |
| 467 | 467 | |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | * @param Task $task |
| 473 | 473 | * @return $this |
| 474 | 474 | */ |
| 475 | - public function removeDependent (Task $task) { |
|
| 475 | + public function removeDependent(Task $task) { |
|
| 476 | 476 | return $this->removeDependents([$task]); |
| 477 | 477 | } |
| 478 | 478 | |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | * @param Task[] $tasks |
| 484 | 484 | * @return $this |
| 485 | 485 | */ |
| 486 | - public function removeDependents (array $tasks) { |
|
| 486 | + public function removeDependents(array $tasks) { |
|
| 487 | 487 | $this->api->post("{$this}/removeDependents", ['dependents' => array_column($tasks, 'gid')]); |
| 488 | 488 | return $this; |
| 489 | 489 | } |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | * @param User $user |
| 495 | 495 | * @return $this |
| 496 | 496 | */ |
| 497 | - public function removeFollower (User $user) { |
|
| 497 | + public function removeFollower(User $user) { |
|
| 498 | 498 | return $this->removeFollowers([$user]); |
| 499 | 499 | } |
| 500 | 500 | |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | * @param User[] $users |
| 507 | 507 | * @return $this |
| 508 | 508 | */ |
| 509 | - public function removeFollowers (array $users) { |
|
| 509 | + public function removeFollowers(array $users) { |
|
| 510 | 510 | return $this->_removeWithPost("{$this}/removeFollowers", [ |
| 511 | 511 | 'followers' => array_column($users, 'gid') |
| 512 | 512 | ], 'followers', $users); |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | * @param Project $project |
| 521 | 521 | * @return $this |
| 522 | 522 | */ |
| 523 | - public function removeFromProject (Project $project) { |
|
| 523 | + public function removeFromProject(Project $project) { |
|
| 524 | 524 | return $this->_removeWithPost("{$this}/removeProject", [ |
| 525 | 525 | 'project' => $project->getGid() |
| 526 | 526 | ], 'memberships', function(Membership $membership) use ($project) { |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | * @param Tag $tag |
| 537 | 537 | * @return $this |
| 538 | 538 | */ |
| 539 | - public function removeTag (Tag $tag) { |
|
| 539 | + public function removeTag(Tag $tag) { |
|
| 540 | 540 | return $this->_removeWithPost("{$this}/removeTag", [ |
| 541 | 541 | 'tag' => $tag->getGid() |
| 542 | 542 | ], 'tags', [$tag]); |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | * @param callable $filter `fn( Attachment $attachment): bool` |
| 547 | 547 | * @return Attachment[] |
| 548 | 548 | */ |
| 549 | - public function selectAttachments (callable $filter) { |
|
| 549 | + public function selectAttachments(callable $filter) { |
|
| 550 | 550 | return $this->_select($this->getAttachments(), $filter); |
| 551 | 551 | } |
| 552 | 552 | |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | * @param callable $filter `fn( Story $comment ): bool` |
| 555 | 555 | * @return Story[] |
| 556 | 556 | */ |
| 557 | - public function selectComments (callable $filter) { |
|
| 557 | + public function selectComments(callable $filter) { |
|
| 558 | 558 | return $this->_select($this->getComments(), $filter); |
| 559 | 559 | } |
| 560 | 560 | |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | * @param callable $filter `fn( Task $dependency ): bool` |
| 563 | 563 | * @return Task[] |
| 564 | 564 | */ |
| 565 | - public function selectDependencies (callable $filter) { |
|
| 565 | + public function selectDependencies(callable $filter) { |
|
| 566 | 566 | return $this->_select($this->getDependencies(), $filter); |
| 567 | 567 | } |
| 568 | 568 | |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | * @param callable $filter `fn( Task $dependent ): bool` |
| 571 | 571 | * @return Task[] |
| 572 | 572 | */ |
| 573 | - public function selectDependents (callable $filter) { |
|
| 573 | + public function selectDependents(callable $filter) { |
|
| 574 | 574 | return $this->_select($this->getDependents(), $filter); |
| 575 | 575 | } |
| 576 | 576 | |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | * @param callable $filter `fn( Project $project ): bool` |
| 579 | 579 | * @return Project[] |
| 580 | 580 | */ |
| 581 | - public function selectProjects (callable $filter) { |
|
| 581 | + public function selectProjects(callable $filter) { |
|
| 582 | 582 | return $this->_select($this->getProjects(), $filter); |
| 583 | 583 | } |
| 584 | 584 | |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | * @param callable $filter `fn( Story $story ): bool` |
| 587 | 587 | * @return Story[] |
| 588 | 588 | */ |
| 589 | - public function selectStories (callable $filter) { |
|
| 589 | + public function selectStories(callable $filter) { |
|
| 590 | 590 | return $this->_select($this->getStories(), $filter); |
| 591 | 591 | } |
| 592 | 592 | |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | * @param callable $filter `fn( Task $subtask ): bool` |
| 595 | 595 | * @return Task[] |
| 596 | 596 | */ |
| 597 | - public function selectSubTasks (callable $filter) { |
|
| 597 | + public function selectSubTasks(callable $filter) { |
|
| 598 | 598 | return $this->_select($this->getSubTasks(), $filter); |
| 599 | 599 | } |
| 600 | 600 | |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | * @param null|string|DateTimeInterface $date |
| 603 | 603 | * @return Task |
| 604 | 604 | */ |
| 605 | - public function setDueOn ($date) { |
|
| 605 | + public function setDueOn($date) { |
|
| 606 | 606 | if ($date instanceof DateTimeInterface) { |
| 607 | 607 | $date = $date->format('Y-m-d'); |
| 608 | 608 | } |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | * @param null|Task $parent |
| 617 | 617 | * @return $this |
| 618 | 618 | */ |
| 619 | - public function setParent (?self $parent) { |
|
| 619 | + public function setParent(?self $parent) { |
|
| 620 | 620 | return $this->_setWithPost("{$this}/setParent", [ |
| 621 | 621 | 'parent' => $parent |
| 622 | 622 | ], 'parent', $parent); |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | * @param bool $flag |
| 627 | 627 | * @return $this |
| 628 | 628 | */ |
| 629 | - public function setRenderedAsSeparator (bool $flag) { |
|
| 629 | + public function setRenderedAsSeparator(bool $flag) { |
|
| 630 | 630 | return $this->_set('is_rendered_as_separator', $flag); |
| 631 | 631 | } |
| 632 | 632 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | 'workspaces' => [Workspace::class] |
| 30 | 30 | ]; |
| 31 | 31 | |
| 32 | - final public function __toString (): string { |
|
| 32 | + final public function __toString(): string { |
|
| 33 | 33 | return "users/{$this->getGid()}"; |
| 34 | 34 | } |
| 35 | 35 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @param Workspace $workspace |
| 38 | 38 | * @return $this |
| 39 | 39 | */ |
| 40 | - public function addToWorkspace (Workspace $workspace) { |
|
| 40 | + public function addToWorkspace(Workspace $workspace) { |
|
| 41 | 41 | return $this->_addWithPost("{$workspace}/addUser", [ |
| 42 | 42 | 'user' => $this->getGid() |
| 43 | 43 | ], 'workspaces', [$workspace]); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @return Workspace |
| 51 | 51 | */ |
| 52 | - public function getDefaultWorkspace () { |
|
| 52 | + public function getDefaultWorkspace() { |
|
| 53 | 53 | return $this->getWorkspaces()[0]; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @param null|Workspace $workspace Falls back to the default workspace. |
| 58 | 58 | * @return Portfolio[] |
| 59 | 59 | */ |
| 60 | - public function getFavoritePortfolios (Workspace $workspace = null) { |
|
| 60 | + public function getFavoritePortfolios(Workspace $workspace = null) { |
|
| 61 | 61 | return $this->getFavorites(Portfolio::class, Portfolio::TYPE, $workspace); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param null|Workspace $workspace Falls back to the default workspace. |
| 66 | 66 | * @return Project[] |
| 67 | 67 | */ |
| 68 | - public function getFavoriteProjects (Workspace $workspace = null) { |
|
| 68 | + public function getFavoriteProjects(Workspace $workspace = null) { |
|
| 69 | 69 | return $this->getFavorites(Project::class, Project::TYPE, $workspace); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * @param null|Workspace $workspace Falls back to the default workspace. |
| 74 | 74 | * @return Tag[] |
| 75 | 75 | */ |
| 76 | - public function getFavoriteTags (Workspace $workspace = null) { |
|
| 76 | + public function getFavoriteTags(Workspace $workspace = null) { |
|
| 77 | 77 | return $this->getFavorites(Tag::class, Tag::TYPE, $workspace); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * @param null|Workspace $workspace Falls back to the default workspace. |
| 82 | 82 | * @return Team[] |
| 83 | 83 | */ |
| 84 | - public function getFavoriteTeams (Workspace $workspace = null) { |
|
| 84 | + public function getFavoriteTeams(Workspace $workspace = null) { |
|
| 85 | 85 | return $this->getFavorites(Team::class, Team::TYPE, $workspace); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @param null|Workspace $workspace Falls back to the default workspace. |
| 90 | 90 | * @return User[] |
| 91 | 91 | */ |
| 92 | - public function getFavoriteUsers (Workspace $workspace = null) { |
|
| 92 | + public function getFavoriteUsers(Workspace $workspace = null) { |
|
| 93 | 93 | return $this->getFavorites(self::class, self::TYPE, $workspace); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @param null|Workspace $workspace Falls back to the default workspace. |
| 100 | 100 | * @return array |
| 101 | 101 | */ |
| 102 | - protected function getFavorites (string $class, string $resourceType, Workspace $workspace = null) { |
|
| 102 | + protected function getFavorites(string $class, string $resourceType, Workspace $workspace = null) { |
|
| 103 | 103 | return $this->api->loadAll($this, $class, "{$this}/favorites", [ |
| 104 | 104 | 'resource_type' => $resourceType, |
| 105 | 105 | 'workspace' => ($workspace ?? $this->api->getDefaultWorkspace())->getGid() |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | /** |
| 110 | 110 | * @return string[] |
| 111 | 111 | */ |
| 112 | - public function getPoolKeys () { |
|
| 112 | + public function getPoolKeys() { |
|
| 113 | 113 | $keys = parent::getPoolKeys(); |
| 114 | 114 | |
| 115 | 115 | // include email as a key if it's loaded |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @param null|Workspace $workspace |
| 125 | 125 | * @return Portfolio[] |
| 126 | 126 | */ |
| 127 | - public function getPortfolios (Workspace $workspace = null) { |
|
| 127 | + public function getPortfolios(Workspace $workspace = null) { |
|
| 128 | 128 | return $this->api->loadAll($this, Portfolio::class, "portfolios", [ |
| 129 | 129 | 'workspace' => ($workspace ?? $this->api->getDefaultWorkspace())->getGid(), |
| 130 | 130 | 'owner' => $this->getGid() |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @param null|Workspace $workspace Falls back to the default workspace. |
| 136 | 136 | * @return TaskList |
| 137 | 137 | */ |
| 138 | - public function getTaskList (Workspace $workspace = null) { |
|
| 138 | + public function getTaskList(Workspace $workspace = null) { |
|
| 139 | 139 | return $this->api->load($this, TaskList::class, "{$this}/user_task_list", [ |
| 140 | 140 | 'workspace' => ($workspace ?? $this->api->getDefaultWorkspace())->getGid() |
| 141 | 141 | ]); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @param string[] $filter `workspace` falls back to the default. |
| 148 | 148 | * @return Task[] |
| 149 | 149 | */ |
| 150 | - public function getTasks (array $filter = []) { |
|
| 150 | + public function getTasks(array $filter = []) { |
|
| 151 | 151 | $filter['assignee'] = $this->getGid(); |
| 152 | 152 | $filter += ['workspace' => $this->api->getDefaultWorkspace()->getGid()]; |
| 153 | 153 | return $this->api->loadAll($this, Task::class, 'tasks', $filter); |
@@ -161,13 +161,13 @@ discard block |
||
| 161 | 161 | * @param null|Workspace $organization Falls back to the default workspace. |
| 162 | 162 | * @return Team[] |
| 163 | 163 | */ |
| 164 | - public function getTeams (Workspace $organization = null) { |
|
| 164 | + public function getTeams(Workspace $organization = null) { |
|
| 165 | 165 | return $this->api->loadAll($this, Team::class, "{$this}/teams", [ |
| 166 | 166 | 'organization' => ($organization ?? $this->getDefaultWorkspace())->getGid() |
| 167 | 167 | ]); |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - public function getUrl (): string { |
|
| 170 | + public function getUrl(): string { |
|
| 171 | 171 | return "https://app.asana.com/0/{$this->getGid()}/list"; |
| 172 | 172 | } |
| 173 | 173 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * @param Workspace $workspace |
| 176 | 176 | * @return $this |
| 177 | 177 | */ |
| 178 | - public function removeFromWorkspace (Workspace $workspace) { |
|
| 178 | + public function removeFromWorkspace(Workspace $workspace) { |
|
| 179 | 179 | return $this->_removeWithPost("{$workspace}/removeUser", [ |
| 180 | 180 | 'user' => $this->getGid() |
| 181 | 181 | ], 'workspaces', [$workspace]); |
@@ -78,15 +78,15 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | private $defaultSection; |
| 80 | 80 | |
| 81 | - final public function __toString (): string { |
|
| 81 | + final public function __toString(): string { |
|
| 82 | 82 | return "projects/{$this->getGid()}"; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - final protected function _getDir (): string { |
|
| 85 | + final protected function _getDir(): string { |
|
| 86 | 86 | return 'projects'; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - protected function _setData (array $data): void { |
|
| 89 | + protected function _setData(array $data): void { |
|
| 90 | 90 | // this is always empty. fields are in the settings, values are in tasks. |
| 91 | 91 | unset($data['custom_fields']); |
| 92 | 92 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @param User $user |
| 102 | 102 | * @return $this |
| 103 | 103 | */ |
| 104 | - public function addMember (User $user) { |
|
| 104 | + public function addMember(User $user) { |
|
| 105 | 105 | return $this->addMembers([$user]); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @param User[] $users |
| 111 | 111 | * @return $this |
| 112 | 112 | */ |
| 113 | - public function addMembers (array $users) { |
|
| 113 | + public function addMembers(array $users) { |
|
| 114 | 114 | return $this->_addWithPost("{$this}/addMembers", [ |
| 115 | 115 | 'members' => array_column($users, 'gid') |
| 116 | 116 | ], 'members', $users); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * @param string $target |
| 122 | 122 | * @return ProjectWebhook |
| 123 | 123 | */ |
| 124 | - public function addWebhook (string $target) { |
|
| 124 | + public function addWebhook(string $target) { |
|
| 125 | 125 | /** @var ProjectWebhook $webhook */ |
| 126 | 126 | $webhook = $this->api->factory($this, ProjectWebhook::class); |
| 127 | 127 | return $webhook->create($this, $target); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @param array $schedule |
| 147 | 147 | * @return Job |
| 148 | 148 | */ |
| 149 | - public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) { |
|
| 149 | + public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) { |
|
| 150 | 150 | $data = ['name' => $name]; |
| 151 | 151 | if ($team) { |
| 152 | 152 | $data['team'] = $team->getGid(); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @depends after-create |
| 167 | 167 | * @return Section |
| 168 | 168 | */ |
| 169 | - public function getDefaultSection () { |
|
| 169 | + public function getDefaultSection() { |
|
| 170 | 170 | return $this->defaultSection ?? $this->defaultSection = $this->getSections(1)[0]; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * @param null|string $token |
| 180 | 180 | * @return Event[] |
| 181 | 181 | */ |
| 182 | - public function getEvents (&$token) { |
|
| 182 | + public function getEvents(&$token) { |
|
| 183 | 183 | return $this->api->sync($this->getGid(), $token); |
| 184 | 184 | } |
| 185 | 185 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @param int $limit |
| 192 | 192 | * @return Traversable|Section[] |
| 193 | 193 | */ |
| 194 | - public function getIterator (int $limit = 0) { |
|
| 194 | + public function getIterator(int $limit = 0) { |
|
| 195 | 195 | return $this->api->loadEach($this, Section::class, "{$this}/sections", ['limit' => $limit]); |
| 196 | 196 | } |
| 197 | 197 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * @param int $limit |
| 201 | 201 | * @return Section[] |
| 202 | 202 | */ |
| 203 | - public function getSections (int $limit = 0) { |
|
| 203 | + public function getSections(int $limit = 0) { |
|
| 204 | 204 | return iterator_to_array($this->getIterator($limit)); |
| 205 | 205 | } |
| 206 | 206 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | * @depends after-create |
| 209 | 209 | * @return Status[] |
| 210 | 210 | */ |
| 211 | - public function getStatuses () { |
|
| 211 | + public function getStatuses() { |
|
| 212 | 212 | return $this->api->loadAll($this, Status::class, "{$this}/project_statuses"); |
| 213 | 213 | } |
| 214 | 214 | |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | * @depends after-create |
| 217 | 217 | * @return TaskCounts |
| 218 | 218 | */ |
| 219 | - public function getTaskCounts () { |
|
| 219 | + public function getTaskCounts() { |
|
| 220 | 220 | /** @var array $remote */ |
| 221 | 221 | $remote = $this->api->get("{$this}/task_counts", [], TaskCounts::OPT); |
| 222 | 222 | return $this->api->factory($this, TaskCounts::class, $remote); |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * @param array $filter |
| 230 | 230 | * @return Task[] |
| 231 | 231 | */ |
| 232 | - public function getTasks (array $filter = []) { |
|
| 232 | + public function getTasks(array $filter = []) { |
|
| 233 | 233 | $filter['project'] = $this->getGid(); |
| 234 | 234 | return $this->api->loadAll($this, Task::class, "tasks", $filter); |
| 235 | 235 | } |
@@ -238,25 +238,25 @@ discard block |
||
| 238 | 238 | * @depends after-create |
| 239 | 239 | * @return string |
| 240 | 240 | */ |
| 241 | - public function getUrl (): string { |
|
| 241 | + public function getUrl(): string { |
|
| 242 | 242 | return "https://app.asana.com/0/{$this->getGid()}"; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
| 246 | 246 | * @return ProjectWebhook[] |
| 247 | 247 | */ |
| 248 | - public function getWebhooks () { |
|
| 248 | + public function getWebhooks() { |
|
| 249 | 249 | return $this->api->loadAll($this, ProjectWebhook::class, 'webhooks', [ |
| 250 | 250 | 'workspace' => $this->getWorkspace()->getGid(), |
| 251 | 251 | 'resource' => $this->getGid() |
| 252 | 252 | ]); |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - public function isBoard (): bool { |
|
| 255 | + public function isBoard(): bool { |
|
| 256 | 256 | return $this->getLayout() === self::LAYOUT_BOARD; |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - public function isList (): bool { |
|
| 259 | + public function isList(): bool { |
|
| 260 | 260 | return $this->getLayout() === self::LAYOUT_LIST; |
| 261 | 261 | } |
| 262 | 262 | |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | * @depends after-create |
| 265 | 265 | * @return Section |
| 266 | 266 | */ |
| 267 | - public function newSection () { |
|
| 267 | + public function newSection() { |
|
| 268 | 268 | return $this->api->factory($this, Section::class, ['project' => $this]); |
| 269 | 269 | } |
| 270 | 270 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * @depends after-create |
| 273 | 273 | * @return Status |
| 274 | 274 | */ |
| 275 | - public function newStatus () { |
|
| 275 | + public function newStatus() { |
|
| 276 | 276 | return $this->api->factory($this, Status::class); |
| 277 | 277 | } |
| 278 | 278 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @depends after-create |
| 283 | 283 | * @return Task |
| 284 | 284 | */ |
| 285 | - public function newTask () { |
|
| 285 | + public function newTask() { |
|
| 286 | 286 | return $this->getDefaultSection()->newTask(); |
| 287 | 287 | } |
| 288 | 288 | |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | * @param User $user |
| 292 | 292 | * @return $this |
| 293 | 293 | */ |
| 294 | - public function removeMember (User $user) { |
|
| 294 | + public function removeMember(User $user) { |
|
| 295 | 295 | return $this->removeMembers([$user]); |
| 296 | 296 | } |
| 297 | 297 | |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | * @param User[] $users |
| 301 | 301 | * @return $this |
| 302 | 302 | */ |
| 303 | - public function removeMembers (array $users) { |
|
| 303 | + public function removeMembers(array $users) { |
|
| 304 | 304 | return $this->_removeWithPost("{$this}/removeMembers", [ |
| 305 | 305 | 'members' => array_column($users, 'gid') |
| 306 | 306 | ], 'members', $users); |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | * @param callable $filter `fn( Section $section ): bool` |
| 311 | 311 | * @return Section[] |
| 312 | 312 | */ |
| 313 | - public function selectSections (callable $filter) { |
|
| 313 | + public function selectSections(callable $filter) { |
|
| 314 | 314 | return $this->_select($this->getSections(), $filter); |
| 315 | 315 | } |
| 316 | 316 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | * @param callable $filter `fn( Status $status ): bool` |
| 319 | 319 | * @return Status[] |
| 320 | 320 | */ |
| 321 | - public function selectStatuses (callable $filter) { |
|
| 321 | + public function selectStatuses(callable $filter) { |
|
| 322 | 322 | return $this->_select($this->getStatuses(), $filter); |
| 323 | 323 | } |
| 324 | 324 | |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | * @param array $apiFilter Pre-filter given to the API to reduce network load. |
| 328 | 328 | * @return Task[] |
| 329 | 329 | */ |
| 330 | - public function selectTasks (callable $filter, array $apiFilter = []) { |
|
| 330 | + public function selectTasks(callable $filter, array $apiFilter = []) { |
|
| 331 | 331 | return $this->_select($this->getTasks($apiFilter), $filter); |
| 332 | 332 | } |
| 333 | 333 | |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | * @param null|Team $team |
| 337 | 337 | * @return $this |
| 338 | 338 | */ |
| 339 | - public function setTeam (?Team $team) { |
|
| 339 | + public function setTeam(?Team $team) { |
|
| 340 | 340 | if ($team and !$this->hasWorkspace()) { |
| 341 | 341 | $this->setWorkspace($team->getOrganization()); |
| 342 | 342 | } |