@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | 'workspace' => Workspace::class |
53 | 53 | ]; |
54 | 54 | |
55 | - final public function __toString (): string { |
|
55 | + final public function __toString(): string { |
|
56 | 56 | return "portfolios/{$this->getGid()}"; |
57 | 57 | } |
58 | 58 | |
59 | - final protected function _getDir (): string { |
|
59 | + final protected function _getDir(): string { |
|
60 | 60 | return 'portfolios'; |
61 | 61 | } |
62 | 62 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param Project $item |
66 | 66 | * @return $this |
67 | 67 | */ |
68 | - public function addItem (Project $item) { |
|
68 | + public function addItem(Project $item) { |
|
69 | 69 | $this->api->post("{$this}/addItem", ['item' => $item->getGid()]); |
70 | 70 | return $this; |
71 | 71 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param User $user |
75 | 75 | * @return $this |
76 | 76 | */ |
77 | - public function addMember (User $user) { |
|
77 | + public function addMember(User $user) { |
|
78 | 78 | return $this->addMembers([$user]); |
79 | 79 | } |
80 | 80 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param User[] $users |
83 | 83 | * @return $this |
84 | 84 | */ |
85 | - public function addMembers (array $users) { |
|
85 | + public function addMembers(array $users) { |
|
86 | 86 | return $this->_addWithPost("{$this}/addMembers", [ |
87 | 87 | 'members' => array_column($users, 'gid') |
88 | 88 | ], 'members', $users); |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | * @depends after-create |
93 | 93 | * @return Project[] |
94 | 94 | */ |
95 | - public function getItems () { |
|
95 | + public function getItems() { |
|
96 | 96 | return iterator_to_array($this); |
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
100 | 100 | * @return Traversable|Project[] |
101 | 101 | */ |
102 | - public function getIterator () { |
|
102 | + public function getIterator() { |
|
103 | 103 | return $this->_loadEach(Project::class, "{$this}/items"); |
104 | 104 | } |
105 | 105 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param Project $item |
109 | 109 | * @return $this |
110 | 110 | */ |
111 | - public function removeItem (Project $item) { |
|
111 | + public function removeItem(Project $item) { |
|
112 | 112 | $this->api->post("{$this}/removeItem", ['item' => $item->getGid()]); |
113 | 113 | return $this; |
114 | 114 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param User $user |
118 | 118 | * @return $this |
119 | 119 | */ |
120 | - public function removeMember (User $user) { |
|
120 | + public function removeMember(User $user) { |
|
121 | 121 | return $this->removeMembers([$user]); |
122 | 122 | } |
123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @param User[] $users |
126 | 126 | * @return $this |
127 | 127 | */ |
128 | - public function removeMembers (array $users) { |
|
128 | + public function removeMembers(array $users) { |
|
129 | 129 | return $this->_removeWithPost("{$this}/removeMembers", [ |
130 | 130 | 'members' => array_column($users, 'gid') |
131 | 131 | ], 'members', $users); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @param callable $filter `fn( Project $project ): bool` |
136 | 136 | * @return Project[] |
137 | 137 | */ |
138 | - public function selectItems (callable $filter) { |
|
138 | + public function selectItems(callable $filter) { |
|
139 | 139 | return $this->_select($this, $filter); |
140 | 140 | } |
141 | 141 | } |
142 | 142 | \ No newline at end of file |
@@ -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']); |
124 | 124 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @param string $file |
136 | 136 | * @return Attachment |
137 | 137 | */ |
138 | - public function addAttachment (string $file) { |
|
138 | + public function addAttachment(string $file) { |
|
139 | 139 | /** @var Attachment $attachment */ |
140 | 140 | $attachment = $this->_factory(Attachment::class, ['parent' => $this]); |
141 | 141 | return $attachment->upload($file); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @param string $text |
148 | 148 | * @return Story |
149 | 149 | */ |
150 | - public function addComment (string $text) { |
|
150 | + public function addComment(string $text) { |
|
151 | 151 | return $this->newComment()->setText($text)->create(); |
152 | 152 | } |
153 | 153 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @param Task[] $tasks |
159 | 159 | * @return $this |
160 | 160 | */ |
161 | - public function addDependencies (array $tasks) { |
|
161 | + public function addDependencies(array $tasks) { |
|
162 | 162 | $this->api->post("{$this}/addDependencies", ['dependents' => array_column($tasks, 'gid')]); |
163 | 163 | return $this; |
164 | 164 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param Task $task |
171 | 171 | * @return $this |
172 | 172 | */ |
173 | - public function addDependency (Task $task) { |
|
173 | + public function addDependency(Task $task) { |
|
174 | 174 | return $this->addDependencies([$task]); |
175 | 175 | } |
176 | 176 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @param Task $task |
182 | 182 | * @return $this |
183 | 183 | */ |
184 | - public function addDependent (Task $task) { |
|
184 | + public function addDependent(Task $task) { |
|
185 | 185 | return $this->addDependents([$task]); |
186 | 186 | } |
187 | 187 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @param Task[] $tasks |
193 | 193 | * @return $this |
194 | 194 | */ |
195 | - public function addDependents (array $tasks) { |
|
195 | + public function addDependents(array $tasks) { |
|
196 | 196 | $this->api->post("{$this}/addDependents", ['dependents' => array_column($tasks, 'gid')]); |
197 | 197 | return $this; |
198 | 198 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @param User $user |
204 | 204 | * @return $this |
205 | 205 | */ |
206 | - public function addFollower (User $user) { |
|
206 | + public function addFollower(User $user) { |
|
207 | 207 | return $this->addFollowers([$user]); |
208 | 208 | } |
209 | 209 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * @param User[] $users |
216 | 216 | * @return $this |
217 | 217 | */ |
218 | - public function addFollowers (array $users) { |
|
218 | + public function addFollowers(array $users) { |
|
219 | 219 | return $this->_addWithPost("{$this}/addFollowers", [ |
220 | 220 | 'followers' => array_column($users, 'gid') |
221 | 221 | ], 'followers', $users); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * @param Tag $tag |
230 | 230 | * @return $this |
231 | 231 | */ |
232 | - public function addTag (Tag $tag) { |
|
232 | + public function addTag(Tag $tag) { |
|
233 | 233 | return $this->_addWithPost("{$this}/addTag", [ |
234 | 234 | 'tag' => $tag->getGid() |
235 | 235 | ], 'tags', [$tag]); |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @param Section|null $section |
245 | 245 | * @return $this |
246 | 246 | */ |
247 | - public function addToProject (Project $project, Section $section = null) { |
|
247 | + public function addToProject(Project $project, Section $section = null) { |
|
248 | 248 | /** @var Membership $membership */ |
249 | 249 | $membership = $this->_factory(Membership::class) |
250 | 250 | ->_set('project', $project) |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * @param string $target |
260 | 260 | * @return TaskWebhook |
261 | 261 | */ |
262 | - public function addWebhook (string $target) { |
|
262 | + public function addWebhook(string $target) { |
|
263 | 263 | /** @var TaskWebhook $webhook */ |
264 | 264 | $webhook = $this->_factory(TaskWebhook::class); |
265 | 265 | return $webhook->create($this, $target); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * @param string[] $include |
276 | 276 | * @return Job |
277 | 277 | */ |
278 | - public function duplicate (string $name, array $include) { |
|
278 | + public function duplicate(string $name, array $include) { |
|
279 | 279 | /** @var array $remote */ |
280 | 280 | $remote = $this->api->post("{$this}/duplicate", [ |
281 | 281 | 'name' => $name, |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * @depends after-create |
291 | 291 | * @return Attachment[] |
292 | 292 | */ |
293 | - public function getAttachments () { |
|
293 | + public function getAttachments() { |
|
294 | 294 | return $this->_loadAll(Attachment::class, "{$this}/attachments"); |
295 | 295 | } |
296 | 296 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @depends after-create |
301 | 301 | * @return Story[] |
302 | 302 | */ |
303 | - public function getComments () { |
|
303 | + public function getComments() { |
|
304 | 304 | return $this->selectStories(function(Story $story) { |
305 | 305 | return $story->isComment(); |
306 | 306 | }); |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * @depends after-create |
313 | 313 | * @return Task[] |
314 | 314 | */ |
315 | - public function getDependencies () { |
|
315 | + public function getDependencies() { |
|
316 | 316 | return $this->_loadAll(self::class, "{$this}/dependencies"); |
317 | 317 | } |
318 | 318 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * @depends after-create |
323 | 323 | * @return Task[] |
324 | 324 | */ |
325 | - public function getDependents () { |
|
325 | + public function getDependents() { |
|
326 | 326 | return $this->_loadAll(self::class, "{$this}/dependents"); |
327 | 327 | } |
328 | 328 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * @param null|string $token |
334 | 334 | * @return TaskEvent[]|StoryEvent[] |
335 | 335 | */ |
336 | - public function getEvents (&$token) { |
|
336 | + public function getEvents(&$token) { |
|
337 | 337 | return $this->api->sync($this, $token); |
338 | 338 | } |
339 | 339 | |
@@ -345,14 +345,14 @@ discard block |
||
345 | 345 | * |
346 | 346 | * @return External |
347 | 347 | */ |
348 | - public function getExternal () { |
|
348 | + public function getExternal() { |
|
349 | 349 | return $this->_get('external') ?? $this->data['external'] = $this->_factory(External::class); |
350 | 350 | } |
351 | 351 | |
352 | 352 | /** |
353 | 353 | * @return Project[] |
354 | 354 | */ |
355 | - public function getProjects () { |
|
355 | + public function getProjects() { |
|
356 | 356 | return array_map(function(Membership $membership) { |
357 | 357 | return $membership->getProject(); |
358 | 358 | }, $this->getMemberships()); |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | * @depends after-create |
365 | 365 | * @return Story[] |
366 | 366 | */ |
367 | - public function getStories () { |
|
367 | + public function getStories() { |
|
368 | 368 | return $this->_loadAll(Story::class, "{$this}/stories"); |
369 | 369 | } |
370 | 370 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | * @depends after-create |
375 | 375 | * @return Task[] |
376 | 376 | */ |
377 | - public function getSubTasks () { |
|
377 | + public function getSubTasks() { |
|
378 | 378 | return $this->_loadAll(self::class, "{$this}/subtasks"); |
379 | 379 | } |
380 | 380 | |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | * @depends after-create |
385 | 385 | * @return string |
386 | 386 | */ |
387 | - public function getUrl (): string { |
|
387 | + public function getUrl(): string { |
|
388 | 388 | return "https://app.asana.com/0/0/{$this->getGid()}"; |
389 | 389 | } |
390 | 390 | |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | * @depends after-create |
395 | 395 | * @return TaskWebhook[] |
396 | 396 | */ |
397 | - public function getWebhooks () { |
|
397 | + public function getWebhooks() { |
|
398 | 398 | return $this->_loadAll(TaskWebhook::class, 'webhooks', [ |
399 | 399 | 'workspace' => $this->getWorkspace()->getGid(), |
400 | 400 | 'resource' => $this->getGid() |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | /** |
405 | 405 | * @return bool |
406 | 406 | */ |
407 | - public function isRenderedAsSeparator (): bool { |
|
407 | + public function isRenderedAsSeparator(): bool { |
|
408 | 408 | return $this->_is('is_rendered_as_separator'); |
409 | 409 | } |
410 | 410 | |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | * @depends after-create |
415 | 415 | * @return Story |
416 | 416 | */ |
417 | - public function newComment () { |
|
417 | + public function newComment() { |
|
418 | 418 | return $this->_factory(Story::class, [ |
419 | 419 | 'resource_subtype' => Story::TYPE_COMMENT_ADDED, |
420 | 420 | 'target' => $this |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | * @depends after-create |
428 | 428 | * @return Task |
429 | 429 | */ |
430 | - public function newSubTask () { |
|
430 | + public function newSubTask() { |
|
431 | 431 | /** @var Task $sub */ |
432 | 432 | $sub = $this->_factory(self::class); |
433 | 433 | return $sub->setParent($this); |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | * @param Task[] $tasks |
441 | 441 | * @return $this |
442 | 442 | */ |
443 | - public function removeDependencies (array $tasks) { |
|
443 | + public function removeDependencies(array $tasks) { |
|
444 | 444 | $this->api->post("{$this}/removeDependencies", ['dependencies' => array_column($tasks, 'gid')]); |
445 | 445 | return $this; |
446 | 446 | } |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | * @param Task $task |
453 | 453 | * @return $this |
454 | 454 | */ |
455 | - public function removeDependency (Task $task) { |
|
455 | + public function removeDependency(Task $task) { |
|
456 | 456 | return $this->removeDependencies([$task]); |
457 | 457 | } |
458 | 458 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | * @param Task $task |
464 | 464 | * @return $this |
465 | 465 | */ |
466 | - public function removeDependent (Task $task) { |
|
466 | + public function removeDependent(Task $task) { |
|
467 | 467 | return $this->removeDependents([$task]); |
468 | 468 | } |
469 | 469 | |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | * @param Task[] $tasks |
475 | 475 | * @return $this |
476 | 476 | */ |
477 | - public function removeDependents (array $tasks) { |
|
477 | + public function removeDependents(array $tasks) { |
|
478 | 478 | $this->api->post("{$this}/removeDependents", ['dependents' => array_column($tasks, 'gid')]); |
479 | 479 | return $this; |
480 | 480 | } |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | * @param User $user |
486 | 486 | * @return $this |
487 | 487 | */ |
488 | - public function removeFollower (User $user) { |
|
488 | + public function removeFollower(User $user) { |
|
489 | 489 | return $this->removeFollowers([$user]); |
490 | 490 | } |
491 | 491 | |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | * @param User[] $users |
498 | 498 | * @return $this |
499 | 499 | */ |
500 | - public function removeFollowers (array $users) { |
|
500 | + public function removeFollowers(array $users) { |
|
501 | 501 | return $this->_removeWithPost("{$this}/removeFollowers", [ |
502 | 502 | 'followers' => array_column($users, 'gid') |
503 | 503 | ], 'followers', $users); |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | * @param Project $project |
512 | 512 | * @return $this |
513 | 513 | */ |
514 | - public function removeFromProject (Project $project) { |
|
514 | + public function removeFromProject(Project $project) { |
|
515 | 515 | return $this->_removeWithPost("{$this}/removeProject", [ |
516 | 516 | 'project' => $project->getGid() |
517 | 517 | ], 'memberships', function(Membership $membership) use ($project) { |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | * @param Tag $tag |
528 | 528 | * @return $this |
529 | 529 | */ |
530 | - public function removeTag (Tag $tag) { |
|
530 | + public function removeTag(Tag $tag) { |
|
531 | 531 | return $this->_removeWithPost("{$this}/removeTag", [ |
532 | 532 | 'tag' => $tag->getGid() |
533 | 533 | ], 'tags', [$tag]); |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | * @param callable $filter `fn( Attachment $attachment): bool` |
538 | 538 | * @return Attachment[] |
539 | 539 | */ |
540 | - public function selectAttachments (callable $filter) { |
|
540 | + public function selectAttachments(callable $filter) { |
|
541 | 541 | return $this->_select($this->getAttachments(), $filter); |
542 | 542 | } |
543 | 543 | |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | * @param callable $filter `fn( Story $comment ): bool` |
546 | 546 | * @return Story[] |
547 | 547 | */ |
548 | - public function selectComments (callable $filter) { |
|
548 | + public function selectComments(callable $filter) { |
|
549 | 549 | return $this->_select($this->getComments(), $filter); |
550 | 550 | } |
551 | 551 | |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | * @param callable $filter `fn( Task $dependency ): bool` |
554 | 554 | * @return Task[] |
555 | 555 | */ |
556 | - public function selectDependencies (callable $filter) { |
|
556 | + public function selectDependencies(callable $filter) { |
|
557 | 557 | return $this->_select($this->getDependencies(), $filter); |
558 | 558 | } |
559 | 559 | |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | * @param callable $filter `fn( Task $dependent ): bool` |
562 | 562 | * @return Task[] |
563 | 563 | */ |
564 | - public function selectDependents (callable $filter) { |
|
564 | + public function selectDependents(callable $filter) { |
|
565 | 565 | return $this->_select($this->getDependents(), $filter); |
566 | 566 | } |
567 | 567 | |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | * @param callable $filter `fn( Project $project ): bool` |
570 | 570 | * @return Project[] |
571 | 571 | */ |
572 | - public function selectProjects (callable $filter) { |
|
572 | + public function selectProjects(callable $filter) { |
|
573 | 573 | return $this->_select($this->getProjects(), $filter); |
574 | 574 | } |
575 | 575 | |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | * @param callable $filter `fn( Story $story ): bool` |
578 | 578 | * @return Story[] |
579 | 579 | */ |
580 | - public function selectStories (callable $filter) { |
|
580 | + public function selectStories(callable $filter) { |
|
581 | 581 | return $this->_select($this->getStories(), $filter); |
582 | 582 | } |
583 | 583 | |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | * @param callable $filter `fn( Task $subtask ): bool` |
586 | 586 | * @return Task[] |
587 | 587 | */ |
588 | - public function selectSubTasks (callable $filter) { |
|
588 | + public function selectSubTasks(callable $filter) { |
|
589 | 589 | return $this->_select($this->getSubTasks(), $filter); |
590 | 590 | } |
591 | 591 | |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | * @param null|Task $parent |
597 | 597 | * @return $this |
598 | 598 | */ |
599 | - public function setParent (?self $parent) { |
|
599 | + public function setParent(?self $parent) { |
|
600 | 600 | return $this->_setWithPost("{$this}/setParent", [ |
601 | 601 | 'parent' => $parent |
602 | 602 | ], 'parent', $parent); |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | * @param bool $flag |
607 | 607 | * @return $this |
608 | 608 | */ |
609 | - public function setRenderedAsSeparator (bool $flag) { |
|
609 | + public function setRenderedAsSeparator(bool $flag) { |
|
610 | 610 | return $this->_set('is_rendered_as_separator', $flag); |
611 | 611 | } |
612 | 612 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | 'workspaces' => [Workspace::class] |
29 | 29 | ]; |
30 | 30 | |
31 | - final public function __toString (): string { |
|
31 | + final public function __toString(): string { |
|
32 | 32 | return "users/{$this->getGid()}"; |
33 | 33 | } |
34 | 34 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param Workspace $workspace |
37 | 37 | * @return $this |
38 | 38 | */ |
39 | - public function addToWorkspace (Workspace $workspace) { |
|
39 | + public function addToWorkspace(Workspace $workspace) { |
|
40 | 40 | return $this->_addWithPost("{$workspace}/addUser", [ |
41 | 41 | 'user' => $this->getGid() |
42 | 42 | ], 'workspaces', [$workspace]); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | /** |
46 | 46 | * @return string[] |
47 | 47 | */ |
48 | - public function getCacheKeys () { |
|
48 | + public function getCacheKeys() { |
|
49 | 49 | $keys = parent::getCacheKeys(); |
50 | 50 | |
51 | 51 | // only include email as a key if it's loaded |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return Workspace |
64 | 64 | */ |
65 | - public function getDefaultWorkspace () { |
|
65 | + public function getDefaultWorkspace() { |
|
66 | 66 | return $this->getWorkspaces()[0]; |
67 | 67 | } |
68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param null|Workspace $workspace Falls back to the default workspace. |
71 | 71 | * @return Portfolio[] |
72 | 72 | */ |
73 | - public function getFavoritePortfolios (Workspace $workspace = null) { |
|
73 | + public function getFavoritePortfolios(Workspace $workspace = null) { |
|
74 | 74 | return $this->getFavorites(Portfolio::class, Portfolio::TYPE, $workspace); |
75 | 75 | } |
76 | 76 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param null|Workspace $workspace Falls back to the default workspace. |
79 | 79 | * @return Project[] |
80 | 80 | */ |
81 | - public function getFavoriteProjects (Workspace $workspace = null) { |
|
81 | + public function getFavoriteProjects(Workspace $workspace = null) { |
|
82 | 82 | return $this->getFavorites(Project::class, Project::TYPE, $workspace); |
83 | 83 | } |
84 | 84 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param null|Workspace $workspace Falls back to the default workspace. |
87 | 87 | * @return Tag[] |
88 | 88 | */ |
89 | - public function getFavoriteTags (Workspace $workspace = null) { |
|
89 | + public function getFavoriteTags(Workspace $workspace = null) { |
|
90 | 90 | return $this->getFavorites(Tag::class, Tag::TYPE, $workspace); |
91 | 91 | } |
92 | 92 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @param null|Workspace $workspace Falls back to the default workspace. |
95 | 95 | * @return Team[] |
96 | 96 | */ |
97 | - public function getFavoriteTeams (Workspace $workspace = null) { |
|
97 | + public function getFavoriteTeams(Workspace $workspace = null) { |
|
98 | 98 | return $this->getFavorites(Team::class, Team::TYPE, $workspace); |
99 | 99 | } |
100 | 100 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @param null|Workspace $workspace Falls back to the default workspace. |
103 | 103 | * @return User[] |
104 | 104 | */ |
105 | - public function getFavoriteUsers (Workspace $workspace = null) { |
|
105 | + public function getFavoriteUsers(Workspace $workspace = null) { |
|
106 | 106 | return $this->getFavorites(self::class, self::TYPE, $workspace); |
107 | 107 | } |
108 | 108 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @param null|Workspace $workspace Falls back to the default workspace. |
113 | 113 | * @return array |
114 | 114 | */ |
115 | - protected function getFavorites (string $class, string $resourceType, Workspace $workspace = null) { |
|
115 | + protected function getFavorites(string $class, string $resourceType, Workspace $workspace = null) { |
|
116 | 116 | return $this->_loadAll($class, "{$this}/favorites", [ |
117 | 117 | 'resource_type' => $resourceType, |
118 | 118 | 'workspace' => ($workspace ?? $this->getDefaultWorkspace())->getGid() |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param null|Workspace $workspace |
124 | 124 | * @return Portfolio[] |
125 | 125 | */ |
126 | - public function getPortfolios (Workspace $workspace = null) { |
|
126 | + public function getPortfolios(Workspace $workspace = null) { |
|
127 | 127 | return $this->_loadAll(Portfolio::class, "portfolios", [ |
128 | 128 | 'workspace' => ($workspace ?? $this->getDefaultWorkspace())->getGid(), |
129 | 129 | 'owner' => $this->getGid() |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param null|Workspace $workspace Falls back to the default workspace. |
135 | 135 | * @return TaskList |
136 | 136 | */ |
137 | - public function getTaskList (Workspace $workspace = null) { |
|
137 | + public function getTaskList(Workspace $workspace = null) { |
|
138 | 138 | return $this->_load(TaskList::class, "{$this}/user_task_list", [ |
139 | 139 | 'workspace' => ($workspace ?? $this->getDefaultWorkspace())->getGid() |
140 | 140 | ]); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param string[] $filter `workspace` falls back to the default. |
147 | 147 | * @return Task[] |
148 | 148 | */ |
149 | - public function getTasks (array $filter = []) { |
|
149 | + public function getTasks(array $filter = []) { |
|
150 | 150 | $filter['assignee'] = $this->getGid(); |
151 | 151 | $filter += ['workspace' => $this->getDefaultWorkspace()->getGid()]; |
152 | 152 | return $this->_loadAll(Task::class, 'tasks', $filter); |
@@ -160,13 +160,13 @@ discard block |
||
160 | 160 | * @param null|Workspace $organization Falls back to the default workspace. |
161 | 161 | * @return Team[] |
162 | 162 | */ |
163 | - public function getTeams (Workspace $organization = null) { |
|
163 | + public function getTeams(Workspace $organization = null) { |
|
164 | 164 | return $this->_loadAll(Team::class, "{$this}/teams", [ |
165 | 165 | 'organization' => ($organization ?? $this->getDefaultWorkspace())->getGid() |
166 | 166 | ]); |
167 | 167 | } |
168 | 168 | |
169 | - public function getUrl (): string { |
|
169 | + public function getUrl(): string { |
|
170 | 170 | return "https://app.asana.com/0/{$this->getGid()}/list"; |
171 | 171 | } |
172 | 172 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param Workspace $workspace |
175 | 175 | * @return $this |
176 | 176 | */ |
177 | - public function removeFromWorkspace (Workspace $workspace) { |
|
177 | + public function removeFromWorkspace(Workspace $workspace) { |
|
178 | 178 | return $this->_removeWithPost("{$workspace}/removeUser", [ |
179 | 179 | 'user' => $this->getGid() |
180 | 180 | ], 'workspaces', [$workspace]); |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | 'workspace' => Workspace::class |
73 | 73 | ]; |
74 | 74 | |
75 | - final public function __toString (): string { |
|
75 | + final public function __toString(): string { |
|
76 | 76 | return "projects/{$this->getGid()}"; |
77 | 77 | } |
78 | 78 | |
79 | - final protected function _getDir (): string { |
|
79 | + final protected function _getDir(): string { |
|
80 | 80 | return 'projects'; |
81 | 81 | } |
82 | 82 | |
83 | - protected function _setData (array $data): void { |
|
83 | + protected function _setData(array $data): void { |
|
84 | 84 | // this is always empty. fields are in the settings, values are in tasks. |
85 | 85 | unset($data['custom_fields']); |
86 | 86 | parent::_setData($data); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @param User $user |
92 | 92 | * @return $this |
93 | 93 | */ |
94 | - public function addMember (User $user) { |
|
94 | + public function addMember(User $user) { |
|
95 | 95 | return $this->addMembers([$user]); |
96 | 96 | } |
97 | 97 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @param User[] $users |
101 | 101 | * @return $this |
102 | 102 | */ |
103 | - public function addMembers (array $users) { |
|
103 | + public function addMembers(array $users) { |
|
104 | 104 | return $this->_addWithPost("{$this}/addMembers", [ |
105 | 105 | 'members' => array_column($users, 'gid') |
106 | 106 | ], 'members', $users); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @param string $target |
112 | 112 | * @return ProjectWebhook |
113 | 113 | */ |
114 | - public function addWebhook (string $target) { |
|
114 | + public function addWebhook(string $target) { |
|
115 | 115 | /** @var ProjectWebhook $webhook */ |
116 | 116 | $webhook = $this->_factory(ProjectWebhook::class); |
117 | 117 | return $webhook->create($this, $target); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @param array $schedule |
137 | 137 | * @return Job |
138 | 138 | */ |
139 | - public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) { |
|
139 | + public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) { |
|
140 | 140 | $data = ['name' => $name]; |
141 | 141 | if ($team) { |
142 | 142 | $data['team'] = $team->getGid(); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @depends after-create |
156 | 156 | * @return Section |
157 | 157 | */ |
158 | - public function getDefaultSection () { |
|
158 | + public function getDefaultSection() { |
|
159 | 159 | return $this->_loadAll(Section::class, "{$this}/sections", ['limit' => 1])[0]; |
160 | 160 | } |
161 | 161 | |
@@ -166,14 +166,14 @@ discard block |
||
166 | 166 | * @param null|string $token |
167 | 167 | * @return ProjectEvent[]|TaskEvent[]|StoryEvent[] |
168 | 168 | */ |
169 | - public function getEvents (&$token) { |
|
169 | + public function getEvents(&$token) { |
|
170 | 170 | return $this->api->sync($this, $token); |
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
174 | 174 | * @return Traversable|Section[] |
175 | 175 | */ |
176 | - public function getIterator () { |
|
176 | + public function getIterator() { |
|
177 | 177 | return $this->_loadEach(Section::class, "{$this}/sections"); |
178 | 178 | } |
179 | 179 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @depends after-create |
182 | 182 | * @return Section[] |
183 | 183 | */ |
184 | - public function getSections () { |
|
184 | + public function getSections() { |
|
185 | 185 | return iterator_to_array($this); |
186 | 186 | } |
187 | 187 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * @depends after-create |
190 | 190 | * @return Status[] |
191 | 191 | */ |
192 | - public function getStatuses () { |
|
192 | + public function getStatuses() { |
|
193 | 193 | return $this->_loadAll(Status::class, "{$this}/project_statuses"); |
194 | 194 | } |
195 | 195 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @param array $filter |
201 | 201 | * @return Task[] |
202 | 202 | */ |
203 | - public function getTasks (array $filter = []) { |
|
203 | + public function getTasks(array $filter = []) { |
|
204 | 204 | $filter['project'] = $this->getGid(); |
205 | 205 | return $this->_loadAll(Task::class, "tasks", $filter); |
206 | 206 | } |
@@ -209,25 +209,25 @@ discard block |
||
209 | 209 | * @depends after-create |
210 | 210 | * @return string |
211 | 211 | */ |
212 | - public function getUrl (): string { |
|
212 | + public function getUrl(): string { |
|
213 | 213 | return "https://app.asana.com/0/{$this->getGid()}"; |
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
217 | 217 | * @return ProjectWebhook[] |
218 | 218 | */ |
219 | - public function getWebhooks () { |
|
219 | + public function getWebhooks() { |
|
220 | 220 | return $this->_loadAll(ProjectWebhook::class, 'webhooks', [ |
221 | 221 | 'workspace' => $this->getWorkspace()->getGid(), |
222 | 222 | 'resource' => $this->getGid() |
223 | 223 | ]); |
224 | 224 | } |
225 | 225 | |
226 | - public function isBoard (): bool { |
|
226 | + public function isBoard(): bool { |
|
227 | 227 | return $this->getLayout() === self::LAYOUT_BOARD; |
228 | 228 | } |
229 | 229 | |
230 | - public function isList (): bool { |
|
230 | + public function isList(): bool { |
|
231 | 231 | return $this->getLayout() === self::LAYOUT_LIST; |
232 | 232 | } |
233 | 233 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * @depends after-create |
236 | 236 | * @return Section |
237 | 237 | */ |
238 | - public function newSection () { |
|
238 | + public function newSection() { |
|
239 | 239 | return $this->_factory(Section::class, ['project' => $this]); |
240 | 240 | } |
241 | 241 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @depends after-create |
244 | 244 | * @return Status |
245 | 245 | */ |
246 | - public function newStatus () { |
|
246 | + public function newStatus() { |
|
247 | 247 | return $this->_factory(Status::class); |
248 | 248 | } |
249 | 249 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @depends after-create |
254 | 254 | * @return Task |
255 | 255 | */ |
256 | - public function newTask () { |
|
256 | + public function newTask() { |
|
257 | 257 | return $this->getDefaultSection()->newTask(); |
258 | 258 | } |
259 | 259 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @param User $user |
263 | 263 | * @return $this |
264 | 264 | */ |
265 | - public function removeMember (User $user) { |
|
265 | + public function removeMember(User $user) { |
|
266 | 266 | return $this->removeMembers([$user]); |
267 | 267 | } |
268 | 268 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @param User[] $users |
272 | 272 | * @return $this |
273 | 273 | */ |
274 | - public function removeMembers (array $users) { |
|
274 | + public function removeMembers(array $users) { |
|
275 | 275 | return $this->_removeWithPost("{$this}/removeMembers", [ |
276 | 276 | 'members' => array_column($users, 'gid') |
277 | 277 | ], 'members', $users); |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * @param callable $filter `fn( Section $section ): bool` |
282 | 282 | * @return Section[] |
283 | 283 | */ |
284 | - public function selectSections (callable $filter) { |
|
284 | + public function selectSections(callable $filter) { |
|
285 | 285 | return $this->_select($this->getSections(), $filter); |
286 | 286 | } |
287 | 287 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @param callable $filter `fn( Status $status ): bool` |
290 | 290 | * @return Status[] |
291 | 291 | */ |
292 | - public function selectStatuses (callable $filter) { |
|
292 | + public function selectStatuses(callable $filter) { |
|
293 | 293 | return $this->_select($this->getStatuses(), $filter); |
294 | 294 | } |
295 | 295 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | * @param array $apiFilter Pre-filter given to the API to reduce network load. |
299 | 299 | * @return Task[] |
300 | 300 | */ |
301 | - public function selectTasks (callable $filter, array $apiFilter = []) { |
|
301 | + public function selectTasks(callable $filter, array $apiFilter = []) { |
|
302 | 302 | return $this->_select($this->getTasks($apiFilter), $filter); |
303 | 303 | } |
304 | 304 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | * @param null|Team $team |
308 | 308 | * @return $this |
309 | 309 | */ |
310 | - public function setTeam (?Team $team) { |
|
310 | + public function setTeam(?Team $team) { |
|
311 | 311 | if ($team and !$this->hasWorkspace()) { |
312 | 312 | $this->setWorkspace($team->getOrganization()); |
313 | 313 | } |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | 'enum_options' => [EnumOption::class], |
41 | 41 | ]; |
42 | 42 | |
43 | - final public function __toString (): string { |
|
43 | + final public function __toString(): string { |
|
44 | 44 | return "custom_fields/{$this->getGid()}"; |
45 | 45 | } |
46 | 46 | |
47 | - final protected function _getDir (): string { |
|
47 | + final protected function _getDir(): string { |
|
48 | 48 | return 'custom_fields'; |
49 | 49 | } |
50 | 50 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param string $name |
57 | 57 | * @return EnumOption |
58 | 58 | */ |
59 | - public function addEnumOption (string $name) { |
|
59 | + public function addEnumOption(string $name) { |
|
60 | 60 | /** @var EnumOption $option */ |
61 | 61 | $option = $this->_factory(EnumOption::class); |
62 | 62 | $option->setName($name); |
@@ -72,35 +72,35 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * @return bool |
74 | 74 | */ |
75 | - public function hasNotificationsEnabled (): bool { |
|
75 | + public function hasNotificationsEnabled(): bool { |
|
76 | 76 | return $this->_is('has_notifications_enabled'); |
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
80 | 80 | * @return bool |
81 | 81 | */ |
82 | - final public function isEnum (): bool { |
|
82 | + final public function isEnum(): bool { |
|
83 | 83 | return $this->getResourceSubtype() === self::TYPE_ENUM; |
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
87 | 87 | * @return bool |
88 | 88 | */ |
89 | - public function isGlobalToWorkspace (): bool { |
|
89 | + public function isGlobalToWorkspace(): bool { |
|
90 | 90 | return $this->_is('is_global_to_workspace'); |
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
94 | 94 | * @return bool |
95 | 95 | */ |
96 | - final public function isNumber (): bool { |
|
96 | + final public function isNumber(): bool { |
|
97 | 97 | return $this->getResourceSubtype() === self::TYPE_NUMBER; |
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
101 | 101 | * @return bool |
102 | 102 | */ |
103 | - final public function isText (): bool { |
|
103 | + final public function isText(): bool { |
|
104 | 104 | return $this->getResourceSubtype() === self::TYPE_TEXT; |
105 | 105 | } |
106 | 106 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param bool $flag |
109 | 109 | * @return $this |
110 | 110 | */ |
111 | - public function setGlobalToWorkspace (bool $flag) { |
|
111 | + public function setGlobalToWorkspace(bool $flag) { |
|
112 | 112 | return $this->_set('is_global_to_workspace', $flag); |
113 | 113 | } |
114 | 114 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param bool $flag |
117 | 117 | * @return $this |
118 | 118 | */ |
119 | - public function setNotificationsEnabled (bool $flag) { |
|
119 | + public function setNotificationsEnabled(bool $flag) { |
|
120 | 120 | return $this->_set('has_notifications_enabled', $flag); |
121 | 121 | } |
122 | 122 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param callable $cmp `fn( EnumOption $a, EnumOption $b ): int` |
125 | 125 | * @return $this |
126 | 126 | */ |
127 | - public function sortEnumOptions (callable $cmp) { |
|
127 | + public function sortEnumOptions(callable $cmp) { |
|
128 | 128 | if ($options = $this->getEnumOptions()) { |
129 | 129 | $prev = $options[0]; // first option on remote |
130 | 130 | usort($options, $cmp); |
@@ -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 = []) { |
|
45 | + public function getIterator(array $filter = []) { |
|
46 | 46 | $filter['section'] = $this->getGid(); |
47 | 47 | return $this->_loadEach(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 = []) { |
|
54 | + public function getTasks(array $filter = []) { |
|
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->_factory(Task::class); |
67 | 67 | return $task->addToProject($this->getProject(), $this); |