Passed
Push — master ( e5878d...3c0c31 )
by y
01:52
created
src/Base/AbstractEntity/DeleteTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     /**
15 15
      * `DELETE`
16 16
      */
17
-    public function delete (): void {
17
+    public function delete(): void {
18 18
         $this->api->delete($this);
19 19
         $this->api->getPool()->remove($this->getPoolKeys());
20 20
     }
Please login to merge, or discard this patch.
src/Base/AbstractEntity/UpdateTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
      *
17 17
      * @return $this
18 18
      */
19
-    public function update () {
19
+    public function update() {
20 20
         if ($this->isDiff()) {
21 21
             /** @var array $remote */
22 22
             $remote = $this->api->put($this, $this->getDiff(), ['expand' => 'this']);
Please login to merge, or discard this patch.
src/Base/AbstractEntity/CreateTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@
 block discarded – undo
16 16
      *
17 17
      * @return string
18 18
      */
19
-    abstract protected function _getDir (): string;
19
+    abstract protected function _getDir(): string;
20 20
 
21 21
     /**
22 22
      * `POST` the new entity to Asana.
23 23
      *
24 24
      * @return $this
25 25
      */
26
-    public function create () {
26
+    public function create() {
27 27
         /** @var array $remote */
28 28
         $remote = $this->api->post($this->_getDir(), $this->getDiff(), ['expand' => 'this']);
29 29
         $this->_setData($remote);
Please login to merge, or discard this patch.
src/CustomField/FieldSettingsTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     /**
18 18
      * @return CustomField[]
19 19
      */
20
-    public function getCustomFields () {
20
+    public function getCustomFields() {
21 21
         return array_column($this->getCustomFieldSettings(), 'custom_field');
22 22
     }
23 23
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      * @param callable $filter `fn( CustomField $field ): bool`
26 26
      * @return CustomField[]
27 27
      */
28
-    public function selectCustomFields (callable $filter) {
28
+    public function selectCustomFields(callable $filter) {
29 29
         return $this->_select($this->getCustomFields(), $filter);
30 30
     }
31 31
 }
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
src/Task.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
         'memberships' => 'memberships.(project|section)'
102 102
     ];
103 103
 
104
-    final public function __toString (): string {
104
+    final public function __toString(): string {
105 105
         return "tasks/{$this->getGid()}";
106 106
     }
107 107
 
108
-    final protected function _getDir (): string {
108
+    final protected function _getDir(): string {
109 109
         return 'tasks';
110 110
     }
111 111
 
112
-    protected function _onSave (): void {
112
+    protected function _onSave(): void {
113 113
         // use isset() to avoid has() fetch.
114 114
         if (isset($this->data['custom_fields'])) {
115 115
             $this->getCustomFields()->diff = [];
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         }
120 120
     }
121 121
 
122
-    protected function _setData (array $data): void {
122
+    protected function _setData(array $data): void {
123 123
         // hearts were deprecated for likes
124 124
         unset($data['hearted'], $data['hearts'], $data['num_hearts']);
125 125
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      * @param string $file
140 140
      * @return Attachment
141 141
      */
142
-    public function addAttachment (string $file) {
142
+    public function addAttachment(string $file) {
143 143
         /** @var Attachment $attachment */
144 144
         $attachment = $this->api->factory($this, Attachment::class, ['parent' => $this]);
145 145
         return $attachment->upload($file);
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      * @param string $text
152 152
      * @return Story
153 153
      */
154
-    public function addComment (string $text) {
154
+    public function addComment(string $text) {
155 155
         return $this->newComment()->setText($text)->create();
156 156
     }
157 157
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      * @param Task[] $tasks
163 163
      * @return $this
164 164
      */
165
-    public function addDependencies (array $tasks) {
165
+    public function addDependencies(array $tasks) {
166 166
         $this->api->post("{$this}/addDependencies", ['dependents' => array_column($tasks, 'gid')]);
167 167
         return $this;
168 168
     }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      * @param Task $task
175 175
      * @return $this
176 176
      */
177
-    public function addDependency (Task $task) {
177
+    public function addDependency(Task $task) {
178 178
         return $this->addDependencies([$task]);
179 179
     }
180 180
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      * @param Task $task
186 186
      * @return $this
187 187
      */
188
-    public function addDependent (Task $task) {
188
+    public function addDependent(Task $task) {
189 189
         return $this->addDependents([$task]);
190 190
     }
191 191
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
      * @param Task[] $tasks
197 197
      * @return $this
198 198
      */
199
-    public function addDependents (array $tasks) {
199
+    public function addDependents(array $tasks) {
200 200
         $this->api->post("{$this}/addDependents", ['dependents' => array_column($tasks, 'gid')]);
201 201
         return $this;
202 202
     }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      * @param User $user
208 208
      * @return $this
209 209
      */
210
-    public function addFollower (User $user) {
210
+    public function addFollower(User $user) {
211 211
         return $this->addFollowers([$user]);
212 212
     }
213 213
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
      * @param User[] $users
220 220
      * @return $this
221 221
      */
222
-    public function addFollowers (array $users) {
222
+    public function addFollowers(array $users) {
223 223
         return $this->_addWithPost("{$this}/addFollowers", [
224 224
             'followers' => array_column($users, 'gid')
225 225
         ], 'followers', $users);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      * @param Tag $tag
234 234
      * @return $this
235 235
      */
236
-    public function addTag (Tag $tag) {
236
+    public function addTag(Tag $tag) {
237 237
         return $this->_addWithPost("{$this}/addTag", [
238 238
             'tag' => $tag->getGid()
239 239
         ], 'tags', [$tag]);
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      * @param Section $section
250 250
      * @return $this
251 251
      */
252
-    public function addToProject (Section $section) {
252
+    public function addToProject(Section $section) {
253 253
         /** @var Membership $membership */
254 254
         $membership = $this->api->factory($this, Membership::class)
255 255
             ->_set('project', $section->getProject())
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
      * @param string $target
265 265
      * @return TaskWebhook
266 266
      */
267
-    public function addWebhook (string $target) {
267
+    public function addWebhook(string $target) {
268 268
         /** @var TaskWebhook $webhook */
269 269
         $webhook = $this->api->factory($this, TaskWebhook::class);
270 270
         return $webhook->create($this, $target);
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
     /**
274 274
      * @return $this
275 275
      */
276
-    public function create () {
276
+    public function create() {
277 277
         $this->_create();
278 278
         $this->_onSave();
279 279
         return $this;
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
      * @param string[] $include
290 290
      * @return Job
291 291
      */
292
-    public function duplicate (string $name, array $include) {
292
+    public function duplicate(string $name, array $include) {
293 293
         /** @var array $remote */
294 294
         $remote = $this->api->post("{$this}/duplicate", [
295 295
             'name' => $name,
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      * @depends after-create
305 305
      * @return Attachment[]
306 306
      */
307
-    public function getAttachments () {
307
+    public function getAttachments() {
308 308
         return $this->api->loadAll($this, Attachment::class, "{$this}/attachments");
309 309
     }
310 310
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
      * @depends after-create
315 315
      * @return Story[]
316 316
      */
317
-    public function getComments () {
317
+    public function getComments() {
318 318
         return $this->selectStories(function(Story $story) {
319 319
             return $story->isComment();
320 320
         });
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
      * @depends after-create
327 327
      * @return Task[]
328 328
      */
329
-    public function getDependencies () {
329
+    public function getDependencies() {
330 330
         return $this->api->loadAll($this, self::class, "{$this}/dependencies");
331 331
     }
332 332
 
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
      * @depends after-create
337 337
      * @return Task[]
338 338
      */
339
-    public function getDependents () {
339
+    public function getDependents() {
340 340
         return $this->api->loadAll($this, self::class, "{$this}/dependents");
341 341
     }
342 342
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
      * @param null|string $token
348 348
      * @return Event[]
349 349
      */
350
-    public function getEvents (&$token) {
350
+    public function getEvents(&$token) {
351 351
         return $this->api->sync($this->getGid(), $token);
352 352
     }
353 353
 
@@ -359,21 +359,21 @@  discard block
 block discarded – undo
359 359
      *
360 360
      * @return External
361 361
      */
362
-    public function getExternal () {
362
+    public function getExternal() {
363 363
         return $this->_get('external') ?? $this->data['external'] = $this->api->factory($this, External::class);
364 364
     }
365 365
 
366 366
     /**
367 367
      * @return Project[]
368 368
      */
369
-    public function getProjects () {
369
+    public function getProjects() {
370 370
         return array_column($this->getMemberships(), 'project');
371 371
     }
372 372
 
373 373
     /**
374 374
      * @return Section[]
375 375
      */
376
-    public function getSections () {
376
+    public function getSections() {
377 377
         return array_column($this->getMemberships(), 'section');
378 378
     }
379 379
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
      * @depends after-create
384 384
      * @return Story[]
385 385
      */
386
-    public function getStories () {
386
+    public function getStories() {
387 387
         return $this->api->loadAll($this, Story::class, "{$this}/stories");
388 388
     }
389 389
 
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
      * @depends after-create
394 394
      * @return Task[]
395 395
      */
396
-    public function getSubTasks () {
396
+    public function getSubTasks() {
397 397
         return $this->api->loadAll($this, self::class, "{$this}/subtasks");
398 398
     }
399 399
 
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
      * @depends after-create
404 404
      * @return string
405 405
      */
406
-    public function getUrl (): string {
406
+    public function getUrl(): string {
407 407
         return "https://app.asana.com/0/0/{$this->getGid()}";
408 408
     }
409 409
 
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
      * @depends after-create
414 414
      * @return TaskWebhook[]
415 415
      */
416
-    public function getWebhooks () {
416
+    public function getWebhooks() {
417 417
         return $this->api->loadAll($this, TaskWebhook::class, 'webhooks', [
418 418
             'workspace' => $this->getWorkspace()->getGid(),
419 419
             'resource' => $this->getGid()
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
     /**
424 424
      * @return bool
425 425
      */
426
-    public function isRenderedAsSeparator (): bool {
426
+    public function isRenderedAsSeparator(): bool {
427 427
         return $this->_is('is_rendered_as_separator');
428 428
     }
429 429
 
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
      * @depends after-create
434 434
      * @return Story
435 435
      */
436
-    public function newComment () {
436
+    public function newComment() {
437 437
         return $this->api->factory($this, Story::class, [
438 438
             'resource_subtype' => Story::TYPE_COMMENT_ADDED,
439 439
             'target' => $this
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
      * @depends after-create
447 447
      * @return Task
448 448
      */
449
-    public function newSubTask () {
449
+    public function newSubTask() {
450 450
         /** @var Task $sub */
451 451
         $sub = $this->api->factory($this, self::class);
452 452
         return $sub->setParent($this);
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
      * @param Task[] $tasks
460 460
      * @return $this
461 461
      */
462
-    public function removeDependencies (array $tasks) {
462
+    public function removeDependencies(array $tasks) {
463 463
         $this->api->post("{$this}/removeDependencies", ['dependencies' => array_column($tasks, 'gid')]);
464 464
         return $this;
465 465
     }
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
      * @param Task $task
472 472
      * @return $this
473 473
      */
474
-    public function removeDependency (Task $task) {
474
+    public function removeDependency(Task $task) {
475 475
         return $this->removeDependencies([$task]);
476 476
     }
477 477
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
      * @param Task $task
483 483
      * @return $this
484 484
      */
485
-    public function removeDependent (Task $task) {
485
+    public function removeDependent(Task $task) {
486 486
         return $this->removeDependents([$task]);
487 487
     }
488 488
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
      * @param Task[] $tasks
494 494
      * @return $this
495 495
      */
496
-    public function removeDependents (array $tasks) {
496
+    public function removeDependents(array $tasks) {
497 497
         $this->api->post("{$this}/removeDependents", ['dependents' => array_column($tasks, 'gid')]);
498 498
         return $this;
499 499
     }
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
      * @param User $user
505 505
      * @return $this
506 506
      */
507
-    public function removeFollower (User $user) {
507
+    public function removeFollower(User $user) {
508 508
         return $this->removeFollowers([$user]);
509 509
     }
510 510
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
      * @param User[] $users
517 517
      * @return $this
518 518
      */
519
-    public function removeFollowers (array $users) {
519
+    public function removeFollowers(array $users) {
520 520
         return $this->_removeWithPost("{$this}/removeFollowers", [
521 521
             'followers' => array_column($users, 'gid')
522 522
         ], 'followers', $users);
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
      * @param Project $project
531 531
      * @return $this
532 532
      */
533
-    public function removeFromProject (Project $project) {
533
+    public function removeFromProject(Project $project) {
534 534
         return $this->_removeWithPost("{$this}/removeProject", [
535 535
             'project' => $project->getGid()
536 536
         ], 'memberships', function(Membership $membership) use ($project) {
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
      * @param Tag $tag
547 547
      * @return $this
548 548
      */
549
-    public function removeTag (Tag $tag) {
549
+    public function removeTag(Tag $tag) {
550 550
         return $this->_removeWithPost("{$this}/removeTag", [
551 551
             'tag' => $tag->getGid()
552 552
         ], 'tags', [$tag]);
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
      * @param callable $filter `fn( Attachment $attachment): bool`
557 557
      * @return Attachment[]
558 558
      */
559
-    public function selectAttachments (callable $filter) {
559
+    public function selectAttachments(callable $filter) {
560 560
         return $this->_select($this->getAttachments(), $filter);
561 561
     }
562 562
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
      * @param callable $filter `fn( Story $comment ): bool`
565 565
      * @return Story[]
566 566
      */
567
-    public function selectComments (callable $filter) {
567
+    public function selectComments(callable $filter) {
568 568
         return $this->_select($this->getComments(), $filter);
569 569
     }
570 570
 
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
      * @param callable $filter `fn( Task $dependency ): bool`
573 573
      * @return Task[]
574 574
      */
575
-    public function selectDependencies (callable $filter) {
575
+    public function selectDependencies(callable $filter) {
576 576
         return $this->_select($this->getDependencies(), $filter);
577 577
     }
578 578
 
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
      * @param callable $filter `fn( Task $dependent ): bool`
581 581
      * @return Task[]
582 582
      */
583
-    public function selectDependents (callable $filter) {
583
+    public function selectDependents(callable $filter) {
584 584
         return $this->_select($this->getDependents(), $filter);
585 585
     }
586 586
 
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
      * @param callable $filter `fn( Project $project ): bool`
589 589
      * @return Project[]
590 590
      */
591
-    public function selectProjects (callable $filter) {
591
+    public function selectProjects(callable $filter) {
592 592
         return $this->_select($this->getProjects(), $filter);
593 593
     }
594 594
 
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
      * @param callable $filter `fn( Story $story ): bool`
597 597
      * @return Story[]
598 598
      */
599
-    public function selectStories (callable $filter) {
599
+    public function selectStories(callable $filter) {
600 600
         return $this->_select($this->getStories(), $filter);
601 601
     }
602 602
 
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
      * @param callable $filter `fn( Task $subtask ): bool`
605 605
      * @return Task[]
606 606
      */
607
-    public function selectSubTasks (callable $filter) {
607
+    public function selectSubTasks(callable $filter) {
608 608
         return $this->_select($this->getSubTasks(), $filter);
609 609
     }
610 610
 
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
      * @param null|string|DateTimeInterface $date
613 613
      * @return Task
614 614
      */
615
-    public function setDueOn ($date) {
615
+    public function setDueOn($date) {
616 616
         if ($date instanceof DateTimeInterface) {
617 617
             $date = $date->format('Y-m-d');
618 618
         }
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
      * @param null|Task $parent
627 627
      * @return $this
628 628
      */
629
-    public function setParent (?self $parent) {
629
+    public function setParent(?self $parent) {
630 630
         return $this->_setWithPost("{$this}/setParent", [
631 631
             'parent' => $parent
632 632
         ], 'parent', $parent);
@@ -636,14 +636,14 @@  discard block
 block discarded – undo
636 636
      * @param bool $flag
637 637
      * @return $this
638 638
      */
639
-    public function setRenderedAsSeparator (bool $flag) {
639
+    public function setRenderedAsSeparator(bool $flag) {
640 640
         return $this->_set('is_rendered_as_separator', $flag);
641 641
     }
642 642
 
643 643
     /**
644 644
      * @return $this
645 645
      */
646
-    public function update () {
646
+    public function update() {
647 647
         $this->_update();
648 648
         $this->_onSave();
649 649
         return $this;
Please login to merge, or discard this patch.
src/Workspace/WorkspaceTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
      * @param Workspace $workspace
18 18
      * @return $this
19 19
      */
20
-    public function setWorkspace (Workspace $workspace) {
20
+    public function setWorkspace(Workspace $workspace) {
21 21
         return $this->_set('workspace', $workspace);
22 22
     }
23 23
 }
24 24
\ No newline at end of file
Please login to merge, or discard this patch.
src/Task/FieldEntry.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
      * @param null|string $value
27 27
      * @return null|string
28 28
      */
29
-    protected function _toEnumOptionGid ($value) {
29
+    protected function _toEnumOptionGid($value) {
30 30
         return $this->getEnumOptionValues()[$value] ?? $value;
31 31
     }
32 32
 
33 33
     /**
34 34
      * @return string
35 35
      */
36
-    public function getCurrentOptionName () {
36
+    public function getCurrentOptionName() {
37 37
         return $this->getEnumOptionNames()[$this->getValue()];
38 38
     }
39 39
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      *
43 43
      * @return string[]
44 44
      */
45
-    public function getEnumOptionNames () {
45
+    public function getEnumOptionNames() {
46 46
         static $names = []; // shared
47 47
         $gid = $this->data['gid'];
48 48
         return $names[$gid] ?? $names[$gid] = array_column($this->data['enum_options'], 'name', 'gid');
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      *
54 54
      * @return string[]
55 55
      */
56
-    public function getEnumOptionValues () {
56
+    public function getEnumOptionValues() {
57 57
         static $values = []; // shared
58 58
         $gid = $this->data['gid'];
59 59
         return $values[$gid] ?? $values[$gid] = array_column($this->data['enum_options'], 'gid', 'name');
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     /**
63 63
      * @return null|number|string
64 64
      */
65
-    public function getValue () {
65
+    public function getValue() {
66 66
         $type = $this->data['type'];
67 67
         if ($type === CustomField::TYPE_ENUM) {
68 68
             return $this->data['enum_value']['gid'] ?? null;
@@ -70,15 +70,15 @@  discard block
 block discarded – undo
70 70
         return $this->data["{$type}_value"];
71 71
     }
72 72
 
73
-    final public function isEnum (): bool {
73
+    final public function isEnum(): bool {
74 74
         return $this->getType() === CustomField::TYPE_ENUM;
75 75
     }
76 76
 
77
-    final public function isNumber (): bool {
77
+    final public function isNumber(): bool {
78 78
         return $this->getType() === CustomField::TYPE_NUMBER;
79 79
     }
80 80
 
81
-    final public function isText (): bool {
81
+    final public function isText(): bool {
82 82
         return $this->getType() === CustomField::TYPE_TEXT;
83 83
     }
84 84
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      * @param null|number|string $value
87 87
      * @return $this
88 88
      */
89
-    public function setValue ($value) {
89
+    public function setValue($value) {
90 90
         $type = $this->data['type'];
91 91
         $this->diff["{$type}_value"] = true;
92 92
         if ($type === CustomField::TYPE_ENUM) {
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      *
103 103
      * @return array
104 104
      */
105
-    public function toArray (): array {
105
+    public function toArray(): array {
106 106
         // only strip if needed.
107 107
         if (!isset($this->data['resource_subtype'])) {
108 108
             return $this->data;
Please login to merge, or discard this patch.
src/Api/SimpleCachePool.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     /**
34 34
      * @param PSR16 $psr
35 35
      */
36
-    public function __construct (PSR16 $psr) {
36
+    public function __construct(PSR16 $psr) {
37 37
         $this->psr = $psr;
38 38
     }
39 39
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      * @param AbstractEntity $entity
42 42
      * @throws CacheException
43 43
      */
44
-    protected function _add (AbstractEntity $entity): void {
44
+    protected function _add(AbstractEntity $entity): void {
45 45
         $this->psr->set("asana/{$entity->getGid()}", $entity, $this->_getTtl($entity));
46 46
         parent::_add($entity);
47 47
     }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      * @param string[] $keys
52 52
      * @throws CacheException
53 53
      */
54
-    protected function _addKeys (AbstractEntity $entity, ...$keys): void {
54
+    protected function _addKeys(AbstractEntity $entity, ...$keys): void {
55 55
         $gid = $entity->getGid();
56 56
         $ttl = $this->_getTtl($entity);
57 57
         foreach ($keys as $key) {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      * @return null|AbstractEntity
69 69
      * @throws CacheException
70 70
      */
71
-    protected function _get (string $key, $caller) {
71
+    protected function _get(string $key, $caller) {
72 72
         if (!$entity = parent::_get($key, $caller) and $entity = $this->psr->get("asana/{$key}")) {
73 73
             if (is_string($entity)) { // gid ref
74 74
                 if (!$entity = $this->_get($entity, $caller)) {
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         return $entity;
84 84
     }
85 85
 
86
-    protected function _getTtl (AbstractEntity $entity): int {
86
+    protected function _getTtl(AbstractEntity $entity): int {
87 87
         if ($entity instanceof ImmutableInterface) {
88 88
             return strtotime('tomorrow') - time();
89 89
         }
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
      * @return bool
96 96
      * @throws CacheException
97 97
      */
98
-    protected function _has (string $key): bool {
98
+    protected function _has(string $key): bool {
99 99
         return parent::_has($key) or $this->psr->has("asana/{$key}");
100 100
     }
101 101
 
102 102
     /**
103 103
      * @return int
104 104
      */
105
-    public function getTtl (): int {
105
+    public function getTtl(): int {
106 106
         return $this->ttl;
107 107
     }
108 108
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      * @param string[] $keys
111 111
      * @throws CacheException
112 112
      */
113
-    public function remove (array $keys): void {
113
+    public function remove(array $keys): void {
114 114
         parent::remove($keys);
115 115
         foreach ($keys as $key) {
116 116
             $this->psr->delete("asana/{$key}");
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      * @param int $ttl
122 122
      * @return $this
123 123
      */
124
-    public function setTtl (int $ttl) {
124
+    public function setTtl(int $ttl) {
125 125
         $this->ttl = $ttl;
126 126
         return $this;
127 127
     }
Please login to merge, or discard this patch.
src/Task/FieldEntries.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     protected $types = [];
51 51
 
52
-    public function __construct (Task $task, array $data = []) {
52
+    public function __construct(Task $task, array $data = []) {
53 53
         $this->task = $task;
54 54
         parent::__construct($task, $data);
55 55
     }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @param string $i
59 59
      * @param array $data
60 60
      */
61
-    protected function _setMapped (string $i, $data): void {
61
+    protected function _setMapped(string $i, $data): void {
62 62
         /** @var FieldEntry $entry */
63 63
         $entry = $this->api->factory($this, FieldEntry::class, $data);
64 64
         $gid = $entry->getGid();
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * @param $offset
73 73
      * @return null|string
74 74
      */
75
-    protected function _toGid (string $offset) {
75
+    protected function _toGid(string $offset) {
76 76
         if (isset($this->names[$offset])) {
77 77
             return $offset;
78 78
         }
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
     /**
83 83
      * @return int
84 84
      */
85
-    public function count () {
85
+    public function count() {
86 86
         return count($this->data);
87 87
     }
88 88
 
89
-    public function getDiff (): array {
89
+    public function getDiff(): array {
90 90
         return array_map(function(FieldEntry $value) {
91 91
             return $value->getValue();
92 92
         }, array_intersect_key($this->data, $this->diff));
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      * @param $fieldGid
97 97
      * @return FieldEntry
98 98
      */
99
-    public function getField ($fieldGid) {
99
+    public function getField($fieldGid) {
100 100
         return $this->data[$fieldGid];
101 101
     }
102 102
 
@@ -104,41 +104,41 @@  discard block
 block discarded – undo
104 104
      * @param string $name
105 105
      * @return string
106 106
      */
107
-    public function getGid (string $name): string {
107
+    public function getGid(string $name): string {
108 108
         return $this->gids[$name];
109 109
     }
110 110
 
111 111
     /**
112 112
      * @return string[]
113 113
      */
114
-    public function getGids () {
114
+    public function getGids() {
115 115
         return $this->gids;
116 116
     }
117 117
 
118 118
     /**
119 119
      * @return Generator
120 120
      */
121
-    public function getIterator () {
121
+    public function getIterator() {
122 122
         foreach ($this->data as $gid => $field) {
123 123
             yield $gid => $field->getValue();
124 124
         }
125 125
     }
126 126
 
127
-    public function getName (string $fieldGid) {
127
+    public function getName(string $fieldGid) {
128 128
         return $this->names[$fieldGid];
129 129
     }
130 130
 
131 131
     /**
132 132
      * @return string[]
133 133
      */
134
-    public function getNames () {
134
+    public function getNames() {
135 135
         return $this->names;
136 136
     }
137 137
 
138 138
     /**
139 139
      * @return array
140 140
      */
141
-    public function getValues () {
141
+    public function getValues() {
142 142
         return iterator_to_array($this);
143 143
     }
144 144
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      * @param string $offset
147 147
      * @return bool
148 148
      */
149
-    public function offsetExists ($offset) {
149
+    public function offsetExists($offset) {
150 150
         return isset($this->data[$this->_toGid($offset)]);
151 151
     }
152 152
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      * @param string $offset
155 155
      * @return null|number|string
156 156
      */
157
-    public function offsetGet ($offset) {
157
+    public function offsetGet($offset) {
158 158
         return $this->data[$this->_toGid($offset)]->getValue();
159 159
     }
160 160
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      * @param string $offset
163 163
      * @param null|number|string $value
164 164
      */
165
-    public function offsetSet ($offset, $value) {
165
+    public function offsetSet($offset, $value) {
166 166
         $offset = $this->_toGid($offset);
167 167
         $this->data[$offset]->setValue($value);
168 168
         $this->diff[$offset] = true;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      *
175 175
      * @param string $offset
176 176
      */
177
-    public function offsetUnset ($offset) {
177
+    public function offsetUnset($offset) {
178 178
         $this->offsetSet($offset, null);
179 179
     }
180 180
 
Please login to merge, or discard this patch.