Passed
Branch master (5cd5fb)
by y
01:48
created
src/Task/Membership.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
      * @param Section $section
31 31
      * @return $this
32 32
      */
33
-    final public function setSection (Section $section) {
33
+    final public function setSection(Section $section) {
34 34
         $this->_set('project', $section->getProject());
35 35
         $this->_set('section', $section);
36 36
         return $this;
Please login to merge, or discard this patch.
src/Task/Attachment.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
      * @param string $file
44 44
      * @return $this
45 45
      */
46
-    public function create (string $file) {
46
+    public function create(string $file) {
47 47
         assert(!$this->hasGid());
48 48
         // api returns compact version. reload.
49 49
         $remote = $this->api->call('POST', "{$this->getParent()}/attachments", [
Please login to merge, or discard this patch.
src/Task/ExternalData.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      * @param Task $task
31 31
      * @param array $data
32 32
      */
33
-    public function __construct (Task $task, array $data = []) {
33
+    public function __construct(Task $task, array $data = []) {
34 34
         $this->task = $task;
35 35
         parent::__construct($task, $data);
36 36
     }
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      * @param mixed $value
43 43
      * @return $this
44 44
      */
45
-    protected function _set (string $field, $value) {
45
+    protected function _set(string $field, $value) {
46 46
         $this->task->diff['external'] = true;
47 47
         return parent::_set($field, $value);
48 48
     }
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
      *
53 53
      * @return mixed
54 54
      */
55
-    public function getDataJsonDecoded () {
55
+    public function getDataJsonDecoded() {
56 56
         if (strlen($data = $this->getData())) {
57
-            return json_decode($data, true, 512, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR);
57
+            return json_decode($data, true, 512, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR);
58 58
         }
59 59
         return null;
60 60
     }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     /**
63 63
      * @return Task
64 64
      */
65
-    public function getTask () {
65
+    public function getTask() {
66 66
         return $this->task;
67 67
     }
68 68
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      * @param mixed $data
74 74
      * @return $this
75 75
      */
76
-    public function setDataJsonEncoded ($data) {
76
+    public function setDataJsonEncoded($data) {
77 77
         if (isset($data)) {
78 78
             return $this->setData(json_encode($data, JSON_THROW_ON_ERROR));
79 79
         }
Please login to merge, or discard this patch.
src/Task/FieldEntries.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @param Task $task
54 54
      * @param array $data
55 55
      */
56
-    public function __construct (Task $task, array $data = []) {
56
+    public function __construct(Task $task, array $data = []) {
57 57
         $this->task = $task;
58 58
         parent::__construct($task, $data);
59 59
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      * @param mixed $unused
64 64
      * @internal called by an entry
65 65
      */
66
-    final public function __set (string $gid, $unused): void {
66
+    final public function __set(string $gid, $unused): void {
67 67
         $this->diff[$gid] = true;
68 68
         $this->task->diff['custom_fields'] = true;
69 69
     }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * @param mixed $unused
73 73
      * @internal called by the task
74 74
      */
75
-    final public function __unset ($unused): void {
75
+    final public function __unset($unused): void {
76 76
         $this->diff = [];
77 77
         foreach ($this->data as $entry) {
78 78
             $entry->diff = [];
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      * @param string $i
84 84
      * @param array $data
85 85
      */
86
-    protected function _setField (string $i, $data): void {
86
+    protected function _setField(string $i, $data): void {
87 87
         /** @var FieldEntry $entry */
88 88
         $entry = $this->api->factory($this, FieldEntry::class, $data);
89 89
         $gid = $entry->getGid();
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
      * @param string $offset
98 98
      * @return string
99 99
      */
100
-    protected function _toGid (string $offset): string {
100
+    protected function _toGid(string $offset): string {
101 101
         return $this->gids[$offset] ?? $offset;
102 102
     }
103 103
 
104 104
     /**
105 105
      * @return int
106 106
      */
107
-    final public function count (): int {
107
+    final public function count(): int {
108 108
         return count($this->data);
109 109
     }
110 110
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      * @param $fieldGid
113 113
      * @return FieldEntry
114 114
      */
115
-    public function getField ($fieldGid) {
115
+    public function getField($fieldGid) {
116 116
         return $this->data[$fieldGid];
117 117
     }
118 118
 
@@ -120,21 +120,21 @@  discard block
 block discarded – undo
120 120
      * @param string $name
121 121
      * @return string
122 122
      */
123
-    final public function getGid (string $name): string {
123
+    final public function getGid(string $name): string {
124 124
         return $this->gids[$name];
125 125
     }
126 126
 
127 127
     /**
128 128
      * @return string[]
129 129
      */
130
-    final public function getGids () {
130
+    final public function getGids() {
131 131
         return $this->gids;
132 132
     }
133 133
 
134 134
     /**
135 135
      * @return Generator
136 136
      */
137
-    public function getIterator () {
137
+    public function getIterator() {
138 138
         foreach ($this->data as $gid => $field) {
139 139
             yield $gid => $field->getValue();
140 140
         }
@@ -144,21 +144,21 @@  discard block
 block discarded – undo
144 144
      * @param string $fieldGid
145 145
      * @return string
146 146
      */
147
-    final public function getName (string $fieldGid): string {
147
+    final public function getName(string $fieldGid): string {
148 148
         return $this->names[$fieldGid];
149 149
     }
150 150
 
151 151
     /**
152 152
      * @return string[]
153 153
      */
154
-    final public function getNames () {
154
+    final public function getNames() {
155 155
         return $this->names;
156 156
     }
157 157
 
158 158
     /**
159 159
      * @return array
160 160
      */
161
-    final public function getValues (): array {
161
+    final public function getValues(): array {
162 162
         return iterator_to_array($this);
163 163
     }
164 164
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      * @param string $offset
167 167
      * @return bool
168 168
      */
169
-    final public function offsetExists ($offset): bool {
169
+    final public function offsetExists($offset): bool {
170 170
         return isset($this->data[$this->_toGid($offset)]);
171 171
     }
172 172
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      * @param string $offset
175 175
      * @return null|number|string
176 176
      */
177
-    final public function offsetGet ($offset) {
177
+    final public function offsetGet($offset) {
178 178
         return $this->data[$this->_toGid($offset)]->getValue();
179 179
     }
180 180
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      * @param string $offset
183 183
      * @param null|number|string $value
184 184
      */
185
-    final public function offsetSet ($offset, $value): void {
185
+    final public function offsetSet($offset, $value): void {
186 186
         $this->data[$this->_toGid($offset)]->setValue($value);
187 187
     }
188 188
 
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
      *
192 192
      * @param string $offset
193 193
      */
194
-    final public function offsetUnset ($offset): void {
194
+    final public function offsetUnset($offset): void {
195 195
         $this->offsetSet($offset, null);
196 196
     }
197 197
 
198
-    public function toArray (bool $diff = false): array {
198
+    public function toArray(bool $diff = false): array {
199 199
         if ($diff) {
200 200
             return array_map(function(FieldEntry $entry) {
201 201
                 return $entry->getValue();
Please login to merge, or discard this patch.
src/Task.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         'memberships' => 'memberships.(project|section)'
122 122
     ];
123 123
 
124
-    private function _onSave (): void {
124
+    private function _onSave(): void {
125 125
         /** @var FieldEntries $fields */
126 126
         if ($fields = $this->data['custom_fields'] ?? null) {
127 127
             $fields->__unset(true);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         }
133 133
     }
134 134
 
135
-    protected function _setData (array $data): void {
135
+    protected function _setData(array $data): void {
136 136
         // hearts were deprecated for likes.
137 137
         unset($data['hearted'], $data['hearts'], $data['num_hearts']);
138 138
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      * @param string $file
152 152
      * @return Attachment
153 153
      */
154
-    public function addAttachment (string $file) {
154
+    public function addAttachment(string $file) {
155 155
         /** @var Attachment $attachment */
156 156
         $attachment = $this->api->factory($this, Attachment::class, ['parent' => $this]);
157 157
         return $attachment->create($file);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      * @param Task[] $tasks
164 164
      * @return $this
165 165
      */
166
-    public function addDependencies (array $tasks) {
166
+    public function addDependencies(array $tasks) {
167 167
         $this->api->post("{$this}/addDependencies", ['dependents' => array_column($tasks, 'gid')]);
168 168
         return $this;
169 169
     }
@@ -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
 
@@ -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
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
      * @param Task[] $tasks
195 195
      * @return $this
196 196
      */
197
-    public function addDependents (array $tasks) {
197
+    public function addDependents(array $tasks) {
198 198
         $this->api->post("{$this}/addDependents", ['dependents' => array_column($tasks, 'gid')]);
199 199
         return $this;
200 200
     }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      * @param User $user
206 206
      * @return $this
207 207
      */
208
-    public function addFollower (User $user) {
208
+    public function addFollower(User $user) {
209 209
         return $this->addFollowers([$user]);
210 210
     }
211 211
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
      * @param User[] $users
218 218
      * @return $this
219 219
      */
220
-    public function addFollowers (array $users) {
220
+    public function addFollowers(array $users) {
221 221
         return $this->_addWithPost("{$this}/addFollowers", [
222 222
             'followers' => array_column($users, 'gid')
223 223
         ], 'followers', $users);
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
      * @param Tag $tag
232 232
      * @return $this
233 233
      */
234
-    public function addTag (Tag $tag) {
234
+    public function addTag(Tag $tag) {
235 235
         assert($tag->hasGid());
236 236
         return $this->_addWithPost("{$this}/addTag", [
237 237
             'tag' => $tag->getGid()
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      * @param Project|Section $target
250 250
      * @return $this
251 251
      */
252
-    public function addToProject ($target) {
252
+    public function addToProject($target) {
253 253
         assert($target->hasGid());
254 254
         if ($target instanceof Project) {
255 255
             $target = $target->getDefaultSection();
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
     /**
264 264
      * @return $this
265 265
      */
266
-    public function create () {
266
+    public function create() {
267 267
         $this->_create();
268 268
         $this->_onSave();
269 269
         return $this;
@@ -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,
@@ -292,14 +292,14 @@  discard block
 block discarded – undo
292 292
      *
293 293
      * @return Attachment[]
294 294
      */
295
-    public function getAttachments () {
295
+    public function getAttachments() {
296 296
         return $this->api->loadAll($this, Attachment::class, "{$this}/attachments");
297 297
     }
298 298
 
299 299
     /**
300 300
      * @return Story[]
301 301
      */
302
-    public function getComments () {
302
+    public function getComments() {
303 303
         return $this->selectStories(function(Story $story) {
304 304
             return $story->isComment();
305 305
         });
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
      *
311 311
      * @return Task[]
312 312
      */
313
-    public function getDependencies () {
313
+    public function getDependencies() {
314 314
         return $this->api->loadAll($this, self::class, "{$this}/dependencies");
315 315
     }
316 316
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
      *
320 320
      * @return Task[]
321 321
      */
322
-    public function getDependents () {
322
+    public function getDependents() {
323 323
         return $this->api->loadAll($this, self::class, "{$this}/dependents");
324 324
     }
325 325
 
@@ -334,49 +334,49 @@  discard block
 block discarded – undo
334 334
      *
335 335
      * @return ExternalData
336 336
      */
337
-    public function getExternal () {
337
+    public function getExternal() {
338 338
         return $this->_get('external') ?? $this->data['external'] = $this->api->factory($this, ExternalData::class);
339 339
     }
340 340
 
341 341
     /**
342 342
      * @return Project[]
343 343
      */
344
-    public function getProjects () {
344
+    public function getProjects() {
345 345
         return array_column($this->getMemberships(), 'project');
346 346
     }
347 347
 
348 348
     /**
349 349
      * @return Section[]
350 350
      */
351
-    public function getSections () {
351
+    public function getSections() {
352 352
         return array_column($this->getMemberships(), 'section');
353 353
     }
354 354
 
355 355
     /**
356 356
      * @return Story[]
357 357
      */
358
-    public function getStories () {
358
+    public function getStories() {
359 359
         return $this->api->loadAll($this, Story::class, "{$this}/stories");
360 360
     }
361 361
 
362 362
     /**
363 363
      * @return Task[]
364 364
      */
365
-    public function getSubTasks () {
365
+    public function getSubTasks() {
366 366
         return $this->api->loadAll($this, self::class, "{$this}/subtasks");
367 367
     }
368 368
 
369 369
     /**
370 370
      * @return string
371 371
      */
372
-    final public function getUrl (): string {
372
+    final public function getUrl(): string {
373 373
         return "https://app.asana.com/0/0/{$this->getGid()}";
374 374
     }
375 375
 
376 376
     /**
377 377
      * @return TaskWebhook[]
378 378
      */
379
-    public function getWebhooks () {
379
+    public function getWebhooks() {
380 380
         return $this->api->loadAll($this, TaskWebhook::class, 'webhooks', [
381 381
             'workspace' => $this->getWorkspace()->getGid(),
382 382
             'resource' => $this->getGid()
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
      *
389 389
      * @return Story
390 390
      */
391
-    public function newComment () {
391
+    public function newComment() {
392 392
         return $this->api->factory($this, Story::class, [
393 393
             'resource_subtype' => Story::TYPE_COMMENT_ADDED,
394 394
             'target' => $this
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
      *
401 401
      * @return Task
402 402
      */
403
-    public function newSubTask () {
403
+    public function newSubTask() {
404 404
         /** @var Task $sub */
405 405
         $sub = $this->api->factory($this, self::class);
406 406
         return $sub->setParent($this);
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
      *
412 412
      * @return TaskWebhook
413 413
      */
414
-    public function newWebhook () {
414
+    public function newWebhook() {
415 415
         /** @var TaskWebhook $webhook */
416 416
         $webhook = $this->api->factory($this, TaskWebhook::class);
417 417
         return $webhook->setResource($this);
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
      * @param Task[] $tasks
424 424
      * @return $this
425 425
      */
426
-    public function removeDependencies (array $tasks) {
426
+    public function removeDependencies(array $tasks) {
427 427
         $this->api->post("{$this}/removeDependencies", ['dependencies' => array_column($tasks, 'gid')]);
428 428
         return $this;
429 429
     }
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
      * @param Task $task
435 435
      * @return $this
436 436
      */
437
-    public function removeDependency (Task $task) {
437
+    public function removeDependency(Task $task) {
438 438
         return $this->removeDependencies([$task]);
439 439
     }
440 440
 
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
      * @param Task $task
445 445
      * @return $this
446 446
      */
447
-    public function removeDependent (Task $task) {
447
+    public function removeDependent(Task $task) {
448 448
         return $this->removeDependents([$task]);
449 449
     }
450 450
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
      * @param Task[] $tasks
455 455
      * @return $this
456 456
      */
457
-    public function removeDependents (array $tasks) {
457
+    public function removeDependents(array $tasks) {
458 458
         $this->api->post("{$this}/removeDependents", ['dependents' => array_column($tasks, 'gid')]);
459 459
         return $this;
460 460
     }
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
      * @param User $user
466 466
      * @return $this
467 467
      */
468
-    public function removeFollower (User $user) {
468
+    public function removeFollower(User $user) {
469 469
         return $this->removeFollowers([$user]);
470 470
     }
471 471
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
      * @param User[] $users
478 478
      * @return $this
479 479
      */
480
-    public function removeFollowers (array $users) {
480
+    public function removeFollowers(array $users) {
481 481
         return $this->_removeWithPost("{$this}/removeFollowers", [
482 482
             'followers' => array_column($users, 'gid')
483 483
         ], 'followers', $users);
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
      * @param Project $project
492 492
      * @return $this
493 493
      */
494
-    public function removeFromProject (Project $project) {
494
+    public function removeFromProject(Project $project) {
495 495
         return $this->_removeWithPost("{$this}/removeProject", [
496 496
             'project' => $project->getGid()
497 497
         ], 'memberships', function(Membership $membership) use ($project) {
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
      * @param Tag $tag
508 508
      * @return $this
509 509
      */
510
-    public function removeTag (Tag $tag) {
510
+    public function removeTag(Tag $tag) {
511 511
         return $this->_removeWithPost("{$this}/removeTag", [
512 512
             'tag' => $tag->getGid()
513 513
         ], 'tags', [$tag]);
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
      * @param null|Task $parent
521 521
      * @return $this
522 522
      */
523
-    final public function setParent (?Task $parent) {
523
+    final public function setParent(?Task $parent) {
524 524
         assert(!$parent or $parent->hasGid());
525 525
         return $this->_setWithPost("{$this}/setParent", [
526 526
             'parent' => $parent
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
     /**
531 531
      * @return $this
532 532
      */
533
-    public function update () {
533
+    public function update() {
534 534
         $this->_update();
535 535
         $this->_onSave();
536 536
         return $this;
Please login to merge, or discard this patch.
src/Workspace.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      *
41 41
      * @return OrganizationExport
42 42
      */
43
-    public function export () {
43
+    public function export() {
44 44
         /** @var OrganizationExport $export */
45 45
         $export = $this->api->factory($this, OrganizationExport::class);
46 46
         return $export->create($this);
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      * @param int $limit 1-100
65 65
      * @return array|AbstractEntity[]
66 66
      */
67
-    protected function find (string $class, string $text = '*', int $limit = 20) {
67
+    protected function find(string $class, string $text = '*', int $limit = 20) {
68 68
         return $this->api->loadAll($this, $class, "{$this}/typeahead", [
69 69
             'resource_type' => $class::TYPE,
70 70
             'query' => $text,
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      * @param int $limit 1-100
80 80
      * @return CustomField[]
81 81
      */
82
-    public function findCustomFields (string $text = '*', int $limit = 20) {
82
+    public function findCustomFields(string $text = '*', int $limit = 20) {
83 83
         return $this->find(CustomField::class, $text, $limit);
84 84
     }
85 85
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      * @param int $limit 1-100
91 91
      * @return Portfolio[]
92 92
      */
93
-    public function findPortfolios (string $text = '*', int $limit = 20) {
93
+    public function findPortfolios(string $text = '*', int $limit = 20) {
94 94
         return $this->find(Portfolio::class, $text, $limit);
95 95
     }
96 96
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @param int $limit 1-100
102 102
      * @return Project[]
103 103
      */
104
-    public function findProjects (string $text = '*', int $limit = 20) {
104
+    public function findProjects(string $text = '*', int $limit = 20) {
105 105
         return $this->find(Project::class, $text, $limit);
106 106
     }
107 107
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      * @param int $limit 1-100
116 116
      * @return Tag[]
117 117
      */
118
-    public function findTags (string $text = '*', int $limit = 20) {
118
+    public function findTags(string $text = '*', int $limit = 20) {
119 119
         return $this->find(Tag::class, $text, $limit);
120 120
     }
121 121
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      * @param int $limit 1-100
127 127
      * @return Task[]
128 128
      */
129
-    public function findTasks (string $text = '*', int $limit = 20) {
129
+    public function findTasks(string $text = '*', int $limit = 20) {
130 130
         return $this->find(Task::class, $text, $limit);
131 131
     }
132 132
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      *
138 138
      * @return CustomField[]
139 139
      */
140
-    public function getCustomFields () {
140
+    public function getCustomFields() {
141 141
         return $this->api->loadAll($this, CustomField::class, "{$this}/custom_fields");
142 142
     }
143 143
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      *
149 149
      * @return Portfolio[]
150 150
      */
151
-    public function getPortfolios () {
151
+    public function getPortfolios() {
152 152
         return $this->api->loadAll($this, Portfolio::class, "portfolios", [
153 153
             'workspace' => $this->getGid(),
154 154
             'owner' => $this->api->getMe()->getGid() // the only allowed value, but still required.
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      * @param array $filter
164 164
      * @return Project[]
165 165
      */
166
-    public function getProjects (array $filter = Project::GET_ACTIVE) {
166
+    public function getProjects(array $filter = Project::GET_ACTIVE) {
167 167
         $filter['workspace'] = $this->getGid();
168 168
         return $this->api->loadAll($this, Project::class, 'projects', $filter);
169 169
     }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      *
179 179
      * @return Tag[]
180 180
      */
181
-    public function getTags () {
181
+    public function getTags() {
182 182
         return $this->api->loadAll($this, Tag::class, 'tags', ['workspace' => $this->getGid()]);
183 183
     }
184 184
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      *
190 190
      * @return Team[]
191 191
      */
192
-    public function getTeams () {
192
+    public function getTeams() {
193 193
         return $this->api->loadAll($this, Team::class, "organizations/{$this->getGid()}/teams");
194 194
     }
195 195
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
      * @param string $email
200 200
      * @return null|User
201 201
      */
202
-    public function getUserByEmail (string $email) {
202
+    public function getUserByEmail(string $email) {
203 203
         return $this->api->getPool()->get("users/{$email}", $this, function() use ($email) {
204 204
             return $this->selectUsers(function(User $user) use ($email) {
205 205
                     return $user->getEmail() === $email;
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
     /**
211 211
      * @return User[]
212 212
      */
213
-    public function getUsers () {
213
+    public function getUsers() {
214 214
         return $this->api->loadAll($this, User::class, "{$this}/users");
215 215
     }
216 216
 
217 217
     /**
218 218
      * @return ProjectWebhook[]|TaskWebhook[]
219 219
      */
220
-    public function getWebhooks () {
220
+    public function getWebhooks() {
221 221
         return array_map(function(array $each) {
222 222
             return $this->api->getPool()->get($each['gid'], $this, function() use ($each) {
223 223
                 return $this->api->factory($this, [
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
     /**
235 235
      * @return bool
236 236
      */
237
-    final public function isOrganization (): bool {
237
+    final public function isOrganization(): bool {
238 238
         return $this->_is('is_organization');
239 239
     }
240 240
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
      *
244 244
      * @return CustomField
245 245
      */
246
-    public function newCustomField () {
246
+    public function newCustomField() {
247 247
         /** @var CustomField $field */
248 248
         $field = $this->api->factory($this, CustomField::class);
249 249
         return $field->setWorkspace($this);
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
      *
255 255
      * @return Portfolio
256 256
      */
257
-    public function newPortfolio () {
257
+    public function newPortfolio() {
258 258
         /** @var Portfolio $portfolio */
259 259
         $portfolio = $this->api->factory($this, Portfolio::class);
260 260
         return $portfolio->setWorkspace($this);
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      *
266 266
      * @return Project
267 267
      */
268
-    public function newProject () {
268
+    public function newProject() {
269 269
         /** @var Project $project */
270 270
         $project = $this->api->factory($this, Project::class);
271 271
         return $project->setWorkspace($this);
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
      *
277 277
      * @return Tag
278 278
      */
279
-    public function newTag () {
279
+    public function newTag() {
280 280
         /** @var Tag $tag */
281 281
         $tag = $this->api->factory($this, Tag::class);
282 282
         return $tag->setWorkspace($this);
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
      *
288 288
      * @return Task
289 289
      */
290
-    public function newTask () {
290
+    public function newTask() {
291 291
         /** @var Task $task */
292 292
         $task = $this->api->factory($this, Task::class);
293 293
         return $task->setWorkspace($this);
Please login to merge, or discard this patch.
src/Project.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      */
98 98
     private $defaultSection;
99 99
 
100
-    protected function _setData (array $data): void {
100
+    protected function _setData(array $data): void {
101 101
         // this is always empty. fields are in the settings, values are in tasks.
102 102
         unset($data['custom_fields']);
103 103
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      * @param User $user
112 112
      * @return $this
113 113
      */
114
-    public function addFollower (User $user) {
114
+    public function addFollower(User $user) {
115 115
         return $this->addFollowers([$user]);
116 116
     }
117 117
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      * @param User[] $users
120 120
      * @return $this
121 121
      */
122
-    public function addFollowers (array $users) {
122
+    public function addFollowers(array $users) {
123 123
         return $this->_addWithPost("{$this}/addFollowers", [
124 124
             'followers' => array_column($users, 'gid')
125 125
         ], 'followers', $users);
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      * @param User $user
130 130
      * @return $this
131 131
      */
132
-    public function addMember (User $user) {
132
+    public function addMember(User $user) {
133 133
         return $this->addMembers([$user]);
134 134
     }
135 135
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      * @param User[] $users
138 138
      * @return $this
139 139
      */
140
-    public function addMembers (array $users) {
140
+    public function addMembers(array $users) {
141 141
         return $this->_addWithPost("{$this}/addMembers", [
142 142
             'members' => array_column($users, 'gid')
143 143
         ], 'members', $users);
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      * @param array $schedule
162 162
      * @return Job
163 163
      */
164
-    public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) {
164
+    public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) {
165 165
         $data = ['name' => $name];
166 166
         if ($team) {
167 167
             $data['team'] = $team->getGid();
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     /**
181 181
      * @return Section
182 182
      */
183
-    public function getDefaultSection () {
183
+    public function getDefaultSection() {
184 184
         return $this->defaultSection ?? $this->defaultSection = $this->getSections(1)[0];
185 185
     }
186 186
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      * @param int $limit
193 193
      * @return Traversable|Section[]
194 194
      */
195
-    public function getIterator (int $limit = PHP_INT_MAX) {
195
+    public function getIterator(int $limit = PHP_INT_MAX) {
196 196
         return $this->api->loadEach($this, Section::class, "{$this}/sections", ['limit' => $limit]);
197 197
     }
198 198
 
@@ -200,21 +200,21 @@  discard block
 block discarded – undo
200 200
      * @param int $limit
201 201
      * @return Section[]
202 202
      */
203
-    public function getSections (int $limit = PHP_INT_MAX) {
203
+    public function getSections(int $limit = PHP_INT_MAX) {
204 204
         return iterator_to_array($this->getIterator($limit));
205 205
     }
206 206
 
207 207
     /**
208 208
      * @return Status[]
209 209
      */
210
-    public function getStatuses () {
210
+    public function getStatuses() {
211 211
         return $this->api->loadAll($this, Status::class, "{$this}/project_statuses");
212 212
     }
213 213
 
214 214
     /**
215 215
      * @return TaskCounts
216 216
      */
217
-    public function getTaskCounts () {
217
+    public function getTaskCounts() {
218 218
         $remote = $this->api->get("{$this}/task_counts", [
219 219
             'opt_fields' => // opt_expand doesn't work.
220 220
                 'num_completed_milestones,'
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      * @param array $filter
234 234
      * @return Task[]
235 235
      */
236
-    public function getTasks (array $filter = Task::GET_INCOMPLETE) {
236
+    public function getTasks(array $filter = Task::GET_INCOMPLETE) {
237 237
         $filter['project'] = $this->getGid();
238 238
         return $this->api->loadAll($this, Task::class, "tasks", $filter);
239 239
     }
@@ -241,14 +241,14 @@  discard block
 block discarded – undo
241 241
     /**
242 242
      * @return string
243 243
      */
244
-    final public function getUrl (): string {
244
+    final public function getUrl(): string {
245 245
         return "https://app.asana.com/0/{$this->getGid()}";
246 246
     }
247 247
 
248 248
     /**
249 249
      * @return ProjectWebhook[]
250 250
      */
251
-    public function getWebhooks () {
251
+    public function getWebhooks() {
252 252
         return $this->api->loadAll($this, ProjectWebhook::class, 'webhooks', [
253 253
             'workspace' => $this->getWorkspace()->getGid(),
254 254
             'resource' => $this->getGid()
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
     /**
259 259
      * @return bool
260 260
      */
261
-    final public function isTemplate (): bool {
261
+    final public function isTemplate(): bool {
262 262
         return $this->_is('is_template');
263 263
     }
264 264
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
      *
268 268
      * @return Section
269 269
      */
270
-    public function newSection () {
270
+    public function newSection() {
271 271
         return $this->api->factory($this, Section::class, ['project' => $this]);
272 272
     }
273 273
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
      *
277 277
      * @return Status
278 278
      */
279
-    public function newStatus () {
279
+    public function newStatus() {
280 280
         return $this->api->factory($this, Status::class);
281 281
     }
282 282
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      *
286 286
      * @return Task
287 287
      */
288
-    public function newTask () {
288
+    public function newTask() {
289 289
         return $this->getDefaultSection()->newTask();
290 290
     }
291 291
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
      *
295 295
      * @return ProjectWebhook
296 296
      */
297
-    public function newWebhook () {
297
+    public function newWebhook() {
298 298
         /** @var ProjectWebhook $webhook */
299 299
         $webhook = $this->api->factory($this, ProjectWebhook::class);
300 300
         return $webhook->setResource($this);
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      * @param User $user
305 305
      * @return $this
306 306
      */
307
-    public function removeFollower (User $user) {
307
+    public function removeFollower(User $user) {
308 308
         return $this->removeFollowers([$user]);
309 309
     }
310 310
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
      * @param User[] $users
313 313
      * @return $this
314 314
      */
315
-    public function removeFollowers (array $users) {
315
+    public function removeFollowers(array $users) {
316 316
         return $this->_removeWithPost("{$this}/removeFollowers", [
317 317
             'followers' => array_column($users, 'gid')
318 318
         ], 'followers', $users);
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      * @param User $user
323 323
      * @return $this
324 324
      */
325
-    public function removeMember (User $user) {
325
+    public function removeMember(User $user) {
326 326
         return $this->removeMembers([$user]);
327 327
     }
328 328
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
      * @param User[] $users
331 331
      * @return $this
332 332
      */
333
-    public function removeMembers (array $users) {
333
+    public function removeMembers(array $users) {
334 334
         return $this->_removeWithPost("{$this}/removeMembers", [
335 335
             'members' => array_column($users, 'gid')
336 336
         ], 'members', $users);
Please login to merge, or discard this patch.
src/Base/AbstractEntity.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      * @return bool
36 36
      * @internal pool
37 37
      */
38
-    final public function __merge (self $entity): bool {
38
+    final public function __merge(self $entity): bool {
39 39
         $old = $this->toArray();
40 40
         $this->data = array_merge($this->data, array_diff_key($entity->data, $this->diff));
41 41
         return $this->toArray() !== $old;
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      *
47 47
      * @return string
48 48
      */
49
-    final public function __toString (): string {
49
+    final public function __toString(): string {
50 50
         return static::DIR . '/' . $this->getGid();
51 51
     }
52 52
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @param string $field
57 57
      * @return mixed
58 58
      */
59
-    protected function _get (string $field) {
59
+    protected function _get(string $field) {
60 60
         if (!array_key_exists($field, $this->data) and $this->hasGid()) {
61 61
             $this->_reload($field);
62 62
         }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     /**
67 67
      * @param string $field
68 68
      */
69
-    protected function _reload (string $field): void {
69
+    protected function _reload(string $field): void {
70 70
         assert($this->hasGid());
71 71
         $remote = $this->api->get($this, ['opt_fields' => static::OPT_FIELDS[$field] ?? $field]);
72 72
         assert(array_key_exists($field, $remote));
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $this->api->getPool()->add($this);
75 75
     }
76 76
 
77
-    protected function _setData (array $data): void {
77
+    protected function _setData(array $data): void {
78 78
         // meaningless once the entity is being created. it's constant.
79 79
         unset($data['resource_type'], $data['type']);
80 80
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     /**
85 85
      * @return null|string
86 86
      */
87
-    final public function getGid (): ?string {
87
+    final public function getGid(): ?string {
88 88
         return $this->data['gid'] ?? null;
89 89
     }
90 90
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      *
94 94
      * @return string[]
95 95
      */
96
-    public function getPoolKeys () {
96
+    public function getPoolKeys() {
97 97
         return [$this->getGid(), (string)$this];
98 98
     }
99 99
 
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
      *
103 103
      * @return string
104 104
      */
105
-    final public function getResourceType (): string {
105
+    final public function getResourceType(): string {
106 106
         return static::TYPE;
107 107
     }
108 108
 
109 109
     /**
110 110
      * @return bool
111 111
      */
112
-    final public function hasGid (): bool {
112
+    final public function hasGid(): bool {
113 113
         return isset($this->data['gid']);
114 114
     }
115 115
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
      *
119 119
      * @return $this
120 120
      */
121
-    public function reload () {
121
+    public function reload() {
122 122
         assert($this->hasGid());
123 123
         $remote = $this->api->get($this, ['opt_expand' => 'this']);
124 124
         if (!isset($remote['gid'])) { // deleted?
Please login to merge, or discard this patch.
src/Base/AbstractEntity/DateTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      * @param null|string|DateTimeInterface $date
23 23
      * @return $this
24 24
      */
25
-    private function _setYmd (string $field, $date) {
25
+    private function _setYmd(string $field, $date) {
26 26
         if ($date instanceof DateTimeInterface) {
27 27
             $date = $date->format('Y-m-d');
28 28
         }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param null|string|DateTimeInterface $date
34 34
      * @return $this
35 35
      */
36
-    public function setDueOn ($date) {
36
+    public function setDueOn($date) {
37 37
         return $this->_setYmd('due_on', $date);
38 38
     }
39 39
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      * @param null|string|DateTimeInterface $date
42 42
      * @return $this
43 43
      */
44
-    public function setStartOn ($date) {
44
+    public function setStartOn($date) {
45 45
         // Asana says the due date must be present in the request when changing the start date.
46 46
         $this->setDueOn($this->getDueOn());
47 47
         return $this->_setYmd('start_on', $date);
Please login to merge, or discard this patch.