Passed
Push — master ( 85fa92...c01de8 )
by y
02:23
created
src/Task.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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->_factory(Attachment::class, ['parent' => $this]);
144 144
         return $attachment->upload($file);
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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]);
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      * @param Section|null $section
248 248
      * @return $this
249 249
      */
250
-    public function addToProject (Project $project, Section $section = null) {
250
+    public function addToProject(Project $project, Section $section = null) {
251 251
         /** @var Membership $membership */
252 252
         $membership = $this->_factory(Membership::class)
253 253
             ->_set('project', $project)
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
      * @param string $target
263 263
      * @return TaskWebhook
264 264
      */
265
-    public function addWebhook (string $target) {
265
+    public function addWebhook(string $target) {
266 266
         /** @var TaskWebhook $webhook */
267 267
         $webhook = $this->_factory(TaskWebhook::class);
268 268
         return $webhook->create($this, $target);
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
      * @param string[] $include
279 279
      * @return Job
280 280
      */
281
-    public function duplicate (string $name, array $include) {
281
+    public function duplicate(string $name, array $include) {
282 282
         /** @var array $remote */
283 283
         $remote = $this->api->post("{$this}/duplicate", [
284 284
             'name' => $name,
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
      * @depends after-create
294 294
      * @return Attachment[]
295 295
      */
296
-    public function getAttachments () {
296
+    public function getAttachments() {
297 297
         return $this->api->loadAll($this, Attachment::class, "{$this}/attachments");
298 298
     }
299 299
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
      * @depends after-create
304 304
      * @return Story[]
305 305
      */
306
-    public function getComments () {
306
+    public function getComments() {
307 307
         return $this->selectStories(function(Story $story) {
308 308
             return $story->isComment();
309 309
         });
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
      * @depends after-create
316 316
      * @return Task[]
317 317
      */
318
-    public function getDependencies () {
318
+    public function getDependencies() {
319 319
         return $this->api->loadAll($this, self::class, "{$this}/dependencies");
320 320
     }
321 321
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
      * @depends after-create
326 326
      * @return Task[]
327 327
      */
328
-    public function getDependents () {
328
+    public function getDependents() {
329 329
         return $this->api->loadAll($this, self::class, "{$this}/dependents");
330 330
     }
331 331
 
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
      * @param null|string $token
337 337
      * @return Event[]
338 338
      */
339
-    public function getEvents (&$token) {
339
+    public function getEvents(&$token) {
340 340
         return $this->api->sync($this, $token);
341 341
     }
342 342
 
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
      *
349 349
      * @return External
350 350
      */
351
-    public function getExternal () {
351
+    public function getExternal() {
352 352
         return $this->_get('external') ?? $this->data['external'] = $this->_factory(External::class);
353 353
     }
354 354
 
355 355
     /**
356 356
      * @return Project[]
357 357
      */
358
-    public function getProjects () {
358
+    public function getProjects() {
359 359
         return array_map(function(Membership $membership) {
360 360
             return $membership->getProject();
361 361
         }, $this->getMemberships());
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
      * @depends after-create
368 368
      * @return Story[]
369 369
      */
370
-    public function getStories () {
370
+    public function getStories() {
371 371
         return $this->api->loadAll($this, Story::class, "{$this}/stories");
372 372
     }
373 373
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
      * @depends after-create
378 378
      * @return Task[]
379 379
      */
380
-    public function getSubTasks () {
380
+    public function getSubTasks() {
381 381
         return $this->api->loadAll($this, self::class, "{$this}/subtasks");
382 382
     }
383 383
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
      * @depends after-create
388 388
      * @return string
389 389
      */
390
-    public function getUrl (): string {
390
+    public function getUrl(): string {
391 391
         return "https://app.asana.com/0/0/{$this->getGid()}";
392 392
     }
393 393
 
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
      * @depends after-create
398 398
      * @return TaskWebhook[]
399 399
      */
400
-    public function getWebhooks () {
400
+    public function getWebhooks() {
401 401
         return $this->api->loadAll($this, TaskWebhook::class, 'webhooks', [
402 402
             'workspace' => $this->getWorkspace()->getGid(),
403 403
             'resource' => $this->getGid()
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
     /**
408 408
      * @return bool
409 409
      */
410
-    public function isRenderedAsSeparator (): bool {
410
+    public function isRenderedAsSeparator(): bool {
411 411
         return $this->_is('is_rendered_as_separator');
412 412
     }
413 413
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
      * @depends after-create
418 418
      * @return Story
419 419
      */
420
-    public function newComment () {
420
+    public function newComment() {
421 421
         return $this->_factory(Story::class, [
422 422
             'resource_subtype' => Story::TYPE_COMMENT_ADDED,
423 423
             'target' => $this
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
      * @depends after-create
431 431
      * @return Task
432 432
      */
433
-    public function newSubTask () {
433
+    public function newSubTask() {
434 434
         /** @var Task $sub */
435 435
         $sub = $this->_factory(self::class);
436 436
         return $sub->setParent($this);
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
      * @param Task[] $tasks
444 444
      * @return $this
445 445
      */
446
-    public function removeDependencies (array $tasks) {
446
+    public function removeDependencies(array $tasks) {
447 447
         $this->api->post("{$this}/removeDependencies", ['dependencies' => array_column($tasks, 'gid')]);
448 448
         return $this;
449 449
     }
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
      * @param Task $task
456 456
      * @return $this
457 457
      */
458
-    public function removeDependency (Task $task) {
458
+    public function removeDependency(Task $task) {
459 459
         return $this->removeDependencies([$task]);
460 460
     }
461 461
 
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
      * @param Task $task
467 467
      * @return $this
468 468
      */
469
-    public function removeDependent (Task $task) {
469
+    public function removeDependent(Task $task) {
470 470
         return $this->removeDependents([$task]);
471 471
     }
472 472
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
      * @param Task[] $tasks
478 478
      * @return $this
479 479
      */
480
-    public function removeDependents (array $tasks) {
480
+    public function removeDependents(array $tasks) {
481 481
         $this->api->post("{$this}/removeDependents", ['dependents' => array_column($tasks, 'gid')]);
482 482
         return $this;
483 483
     }
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
      * @param User $user
489 489
      * @return $this
490 490
      */
491
-    public function removeFollower (User $user) {
491
+    public function removeFollower(User $user) {
492 492
         return $this->removeFollowers([$user]);
493 493
     }
494 494
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
      * @param User[] $users
501 501
      * @return $this
502 502
      */
503
-    public function removeFollowers (array $users) {
503
+    public function removeFollowers(array $users) {
504 504
         return $this->_removeWithPost("{$this}/removeFollowers", [
505 505
             'followers' => array_column($users, 'gid')
506 506
         ], 'followers', $users);
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
      * @param Project $project
515 515
      * @return $this
516 516
      */
517
-    public function removeFromProject (Project $project) {
517
+    public function removeFromProject(Project $project) {
518 518
         return $this->_removeWithPost("{$this}/removeProject", [
519 519
             'project' => $project->getGid()
520 520
         ], 'memberships', function(Membership $membership) use ($project) {
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
      * @param Tag $tag
531 531
      * @return $this
532 532
      */
533
-    public function removeTag (Tag $tag) {
533
+    public function removeTag(Tag $tag) {
534 534
         return $this->_removeWithPost("{$this}/removeTag", [
535 535
             'tag' => $tag->getGid()
536 536
         ], 'tags', [$tag]);
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
      * @param callable $filter `fn( Attachment $attachment): bool`
541 541
      * @return Attachment[]
542 542
      */
543
-    public function selectAttachments (callable $filter) {
543
+    public function selectAttachments(callable $filter) {
544 544
         return $this->_select($this->getAttachments(), $filter);
545 545
     }
546 546
 
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
      * @param callable $filter `fn( Story $comment ): bool`
549 549
      * @return Story[]
550 550
      */
551
-    public function selectComments (callable $filter) {
551
+    public function selectComments(callable $filter) {
552 552
         return $this->_select($this->getComments(), $filter);
553 553
     }
554 554
 
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
      * @param callable $filter `fn( Task $dependency ): bool`
557 557
      * @return Task[]
558 558
      */
559
-    public function selectDependencies (callable $filter) {
559
+    public function selectDependencies(callable $filter) {
560 560
         return $this->_select($this->getDependencies(), $filter);
561 561
     }
562 562
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
      * @param callable $filter `fn( Task $dependent ): bool`
565 565
      * @return Task[]
566 566
      */
567
-    public function selectDependents (callable $filter) {
567
+    public function selectDependents(callable $filter) {
568 568
         return $this->_select($this->getDependents(), $filter);
569 569
     }
570 570
 
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
      * @param callable $filter `fn( Project $project ): bool`
573 573
      * @return Project[]
574 574
      */
575
-    public function selectProjects (callable $filter) {
575
+    public function selectProjects(callable $filter) {
576 576
         return $this->_select($this->getProjects(), $filter);
577 577
     }
578 578
 
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
      * @param callable $filter `fn( Story $story ): bool`
581 581
      * @return Story[]
582 582
      */
583
-    public function selectStories (callable $filter) {
583
+    public function selectStories(callable $filter) {
584 584
         return $this->_select($this->getStories(), $filter);
585 585
     }
586 586
 
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
      * @param callable $filter `fn( Task $subtask ): bool`
589 589
      * @return Task[]
590 590
      */
591
-    public function selectSubTasks (callable $filter) {
591
+    public function selectSubTasks(callable $filter) {
592 592
         return $this->_select($this->getSubTasks(), $filter);
593 593
     }
594 594
 
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
      * @param null|Task $parent
600 600
      * @return $this
601 601
      */
602
-    public function setParent (?self $parent) {
602
+    public function setParent(?self $parent) {
603 603
         return $this->_setWithPost("{$this}/setParent", [
604 604
             'parent' => $parent
605 605
         ], 'parent', $parent);
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
      * @param bool $flag
610 610
      * @return $this
611 611
      */
612
-    public function setRenderedAsSeparator (bool $flag) {
612
+    public function setRenderedAsSeparator(bool $flag) {
613 613
         return $this->_set('is_rendered_as_separator', $flag);
614 614
     }
615 615
 
Please login to merge, or discard this patch.