Passed
Push — master ( 66162c...998eef )
by y
01:39
created
src/Task.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     const ASSIGN_TODAY = 'today';
74 74
     const ASSIGN_UPCOMING = 'upcoming';
75 75
 
76
-    public function __construct ($caller, array $data = []) {
76
+    public function __construct($caller, array $data = []) {
77 77
         parent::__construct($caller, $data);
78 78
 
79 79
         // Asana has a bug where it returns empty memberships when expanding "this".
@@ -88,15 +88,15 @@  discard block
 block discarded – undo
88 88
         }
89 89
     }
90 90
 
91
-    final public function __toString (): string {
91
+    final public function __toString(): string {
92 92
         return "tasks/{$this->getGid()}";
93 93
     }
94 94
 
95
-    final protected function _getDir (): string {
95
+    final protected function _getDir(): string {
96 96
         return 'tasks';
97 97
     }
98 98
 
99
-    protected function _getMap (): array {
99
+    protected function _getMap(): array {
100 100
         return [
101 101
             'assignee' => User::class,
102 102
             'custom_fields' => CustomValues::class,
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      * @param string $file
117 117
      * @return Attachment
118 118
      */
119
-    public function addAttachment (string $file) {
119
+    public function addAttachment(string $file) {
120 120
         /** @var Attachment $attachment */
121 121
         $attachment = $this->factory(Attachment::class, ['parent' => $this]);
122 122
         return $attachment->upload($file);
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      * @param string $text
130 130
      * @return Story
131 131
      */
132
-    public function addComment (string $text) {
132
+    public function addComment(string $text) {
133 133
         return $this->newComment()->setText($text)->create();
134 134
     }
135 135
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      * @param Task[] $tasks
141 141
      * @return $this
142 142
      */
143
-    public function addDependencies (array $tasks) {
143
+    public function addDependencies(array $tasks) {
144 144
         $this->api->post("{$this}/addDependencies", ['dependents' => static::_getGids($tasks)]);
145 145
         return $this;
146 146
     }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      * @param Task $task
153 153
      * @return $this
154 154
      */
155
-    public function addDependency (Task $task) {
155
+    public function addDependency(Task $task) {
156 156
         return $this->addDependencies([$task]);
157 157
     }
158 158
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      * @param Task $task
164 164
      * @return $this
165 165
      */
166
-    public function addDependent (Task $task) {
166
+    public function addDependent(Task $task) {
167 167
         return $this->addDependents([$task]);
168 168
     }
169 169
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      * @param Task[] $tasks
175 175
      * @return $this
176 176
      */
177
-    public function addDependents (array $tasks) {
177
+    public function addDependents(array $tasks) {
178 178
         $this->api->post("{$this}/addDependents", ['dependents' => static::_getGids($tasks)]);
179 179
         return $this;
180 180
     }
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      * @param User $user
186 186
      * @return $this
187 187
      */
188
-    public function addFollower (User $user) {
188
+    public function addFollower(User $user) {
189 189
         return $this->addFollowers([$user]);
190 190
     }
191 191
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
      * @param User[] $users
196 196
      * @return $this
197 197
      */
198
-    public function addFollowers (array $users) {
198
+    public function addFollowers(array $users) {
199 199
         if ($this->hasGid()) {
200 200
             $this->api->post("{$this}/addFollowers", ['followers' => static::_getGids($users)]);
201 201
             $this->_merge('followers', $users);
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      * @param Tag $tag
213 213
      * @return $this
214 214
      */
215
-    public function addTag (Tag $tag) {
215
+    public function addTag(Tag $tag) {
216 216
         if ($this->hasGid()) {
217 217
             $this->api->post("{$this}/addTag", ['tag' => $tag->getGid()]);
218 218
             $this->_merge('tags', [$tag]);
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      * @param Section $section
230 230
      * @return $this
231 231
      */
232
-    public function addToProject (Section $section) {
232
+    public function addToProject(Section $section) {
233 233
         $project = $section->getProject();
234 234
         if ($this->hasGid()) {
235 235
             $this->api->post("{$this}/addProject", [
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
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->factory(TaskWebhook::class);
269 269
         return $webhook->create($this, $target);
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
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
         $remote = $this->api->post("{$this}/duplicate", [
284 284
             'name' => $name,
285 285
             'include' => array_values($include)
@@ -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->loadAll(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 array_values(array_filter($this->getStories(), 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->loadAll(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->loadAll(self::class, "{$this}/dependents");
330 330
     }
331 331
 
@@ -336,14 +336,14 @@  discard block
 block discarded – undo
336 336
      * @param null|string $token
337 337
      * @return TaskEvent[]|StoryEvent[]
338 338
      */
339
-    public function getEvents (&$token) {
339
+    public function getEvents(&$token) {
340 340
         return $this->api->sync($this, $token);
341 341
     }
342 342
 
343 343
     /**
344 344
      * @return Project[]
345 345
      */
346
-    public function getProjects () {
346
+    public function getProjects() {
347 347
         return array_map(function(Membership $membership) {
348 348
             return $membership->getProject();
349 349
         }, $this->getMemberships());
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
      * @depends after-create
356 356
      * @return Story[]
357 357
      */
358
-    public function getStories () {
358
+    public function getStories() {
359 359
         return $this->loadAll(Story::class, "{$this}/stories");
360 360
     }
361 361
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
      * @depends after-create
366 366
      * @return Task[]
367 367
      */
368
-    public function getSubTasks () {
368
+    public function getSubTasks() {
369 369
         return $this->loadAll(self::class, "{$this}/subtasks");
370 370
     }
371 371
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
      * @depends after-create
376 376
      * @return string
377 377
      */
378
-    public function getUrl (): string {
378
+    public function getUrl(): string {
379 379
         return "https://app.asana.com/0/0/{$this->getGid()}";
380 380
     }
381 381
 
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
      * @depends after-create
386 386
      * @return TaskWebhook[]
387 387
      */
388
-    public function getWebhooks () {
388
+    public function getWebhooks() {
389 389
         return $this->loadAll(TaskWebhook::class, 'webhooks', [
390 390
             'workspace' => $this->getWorkspace()->getGid(),
391 391
             'resource' => $this->getGid()
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
     /**
396 396
      * @return bool
397 397
      */
398
-    public function isRenderedAsSeparator (): bool {
398
+    public function isRenderedAsSeparator(): bool {
399 399
         return $this->_is('is_rendered_as_separator');
400 400
     }
401 401
 
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
      * @depends after-create
406 406
      * @return Story
407 407
      */
408
-    public function newComment () {
408
+    public function newComment() {
409 409
         /** @var Story $comment */
410 410
         $comment = $this->factory(Story::class, [
411 411
             'resource_subtype' => Story::TYPE_COMMENT_ADDED
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
      * @depends after-create
420 420
      * @return Task
421 421
      */
422
-    public function newSubTask () {
422
+    public function newSubTask() {
423 423
         /** @var Task $sub */
424 424
         $sub = $this->factory(self::class);
425 425
         return $sub->setParent($this);
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
      * @param Task[] $tasks
433 433
      * @return $this
434 434
      */
435
-    public function removeDependencies (array $tasks) {
435
+    public function removeDependencies(array $tasks) {
436 436
         $this->api->post("{$this}/removeDependencies", ['dependencies' => static::_getGids($tasks)]);
437 437
         return $this;
438 438
     }
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
      * @param Task $task
445 445
      * @return $this
446 446
      */
447
-    public function removeDependency (Task $task) {
447
+    public function removeDependency(Task $task) {
448 448
         return $this->removeDependencies([$task]);
449 449
     }
450 450
 
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
      * @param Task $task
456 456
      * @return $this
457 457
      */
458
-    public function removeDependent (Task $task) {
458
+    public function removeDependent(Task $task) {
459 459
         return $this->removeDependents([$task]);
460 460
     }
461 461
 
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
      * @param Task[] $tasks
467 467
      * @return $this
468 468
      */
469
-    public function removeDependents (array $tasks) {
469
+    public function removeDependents(array $tasks) {
470 470
         $this->api->post("{$this}/removeDependents", ['dependents' => static::_getGids($tasks)]);
471 471
         return $this;
472 472
     }
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
      * @param User $user
478 478
      * @return $this
479 479
      */
480
-    public function removeFollower (User $user) {
480
+    public function removeFollower(User $user) {
481 481
         return $this->removeFollowers([$user]);
482 482
     }
483 483
 
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
      * @param User[] $users
488 488
      * @return $this
489 489
      */
490
-    public function removeFollowers (array $users) {
490
+    public function removeFollowers(array $users) {
491 491
         if ($this->hasGid()) {
492 492
             $this->api->post("{$this}/removeFollowers", ['followers' => static::_getGids($users)]);
493 493
         }
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
      * @param Project $project
502 502
      * @return $this
503 503
      */
504
-    public function removeFromProject (Project $project) {
504
+    public function removeFromProject(Project $project) {
505 505
         $gid = $project->getGid();
506 506
         if ($this->hasGid()) {
507 507
             $this->api->post("{$this}/removeProject", ['project' => $gid]);
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
      * @param Tag $tag
521 521
      * @return $this
522 522
      */
523
-    public function removeTag (Tag $tag) {
523
+    public function removeTag(Tag $tag) {
524 524
         if ($this->hasGid()) {
525 525
             $this->api->post("{$this}/removeTag", ['tag' => $tag->getGid()]);
526 526
         }
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
      * @param null|Task $parent
535 535
      * @return $this
536 536
      */
537
-    public function setParent (?self $parent) {
537
+    public function setParent(?self $parent) {
538 538
         if ($this->hasGid()) {
539 539
             $this->api->post("{$this}/setParent", ['parent' => $parent ? $parent->getGid() : null]);
540 540
             $this->data['parent'] = $parent;
@@ -549,14 +549,14 @@  discard block
 block discarded – undo
549 549
      * @param bool $flag
550 550
      * @return $this
551 551
      */
552
-    public function setRenderedAsSeparator (bool $flag) {
552
+    public function setRenderedAsSeparator(bool $flag) {
553 553
         return $this->_set('is_rendered_as_separator', $flag);
554 554
     }
555 555
 
556 556
     /**
557 557
      * @return $this
558 558
      */
559
-    public function update () {
559
+    public function update() {
560 560
         $this->_update();
561 561
         // custom_fields is a premium feature, has() and get() will try to fetch unless already set.
562 562
         if (isset($this->data['custom_fields'])) {
Please login to merge, or discard this patch.