@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return string |
32 | 32 | */ |
33 | - final public function __toString (): string { |
|
33 | + final public function __toString(): string { |
|
34 | 34 | return "teams/{$this->getGid()}"; |
35 | 35 | } |
36 | 36 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param User $user |
39 | 39 | * @return $this |
40 | 40 | */ |
41 | - public function addUser (User $user) { |
|
41 | + public function addUser(User $user) { |
|
42 | 42 | $this->api->post("{$this}/addUser", ['user' => $user->getGid()]); |
43 | 43 | return $this; |
44 | 44 | } |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | * @param array $filter |
52 | 52 | * @return Project[] |
53 | 53 | */ |
54 | - public function getProjects (array $filter = Project::GET_ACTIVE) { |
|
54 | + public function getProjects(array $filter = Project::GET_ACTIVE) { |
|
55 | 55 | return $this->api->loadAll($this, Project::class, "{$this}/projects", $filter); |
56 | 56 | } |
57 | 57 | |
58 | - public function getUrl (): string { |
|
58 | + public function getUrl(): string { |
|
59 | 59 | return "https://app.asana.com/0/{$this->getGid()}/overview"; |
60 | 60 | } |
61 | 61 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return User[] |
68 | 68 | */ |
69 | - public function getUsers () { |
|
69 | + public function getUsers() { |
|
70 | 70 | return $this->api->loadAll($this, User::class, "{$this}/users"); |
71 | 71 | } |
72 | 72 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param User $user |
75 | 75 | * @return $this |
76 | 76 | */ |
77 | - public function removeUser (User $user) { |
|
77 | + public function removeUser(User $user) { |
|
78 | 78 | $this->api->post("{$this}/removeUser", ['user' => $user->getGid()]); |
79 | 79 | return $this; |
80 | 80 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @return string |
45 | 45 | */ |
46 | - final public function __toString (): string { |
|
46 | + final public function __toString(): string { |
|
47 | 47 | return "tags/{$this->getGid()}"; |
48 | 48 | } |
49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return string |
54 | 54 | */ |
55 | - final protected function _getDir (): string { |
|
55 | + final protected function _getDir(): string { |
|
56 | 56 | return 'tags'; |
57 | 57 | } |
58 | 58 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param array $filter |
61 | 61 | * @return Traversable|Task[] |
62 | 62 | */ |
63 | - public function getIterator (array $filter = Task::GET_INCOMPLETE) { |
|
63 | + public function getIterator(array $filter = Task::GET_INCOMPLETE) { |
|
64 | 64 | return $this->api->loadEach($this, Task::class, "{$this}/tasks", $filter); |
65 | 65 | } |
66 | 66 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param array $filter |
69 | 69 | * @return Task[] |
70 | 70 | */ |
71 | - public function getTasks (array $filter = Task::GET_INCOMPLETE) { |
|
71 | + public function getTasks(array $filter = Task::GET_INCOMPLETE) { |
|
72 | 72 | return iterator_to_array($this->getIterator($filter)); |
73 | 73 | } |
74 | 74 | } |
75 | 75 | \ No newline at end of file |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @return string |
119 | 119 | */ |
120 | - final public function __toString (): string { |
|
120 | + final public function __toString(): string { |
|
121 | 121 | return "tasks/{$this->getGid()}"; |
122 | 122 | } |
123 | 123 | |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @return string |
128 | 128 | */ |
129 | - final protected function _getDir (): string { |
|
129 | + final protected function _getDir(): string { |
|
130 | 130 | return 'tasks'; |
131 | 131 | } |
132 | 132 | |
133 | - private function _onSave (): void { |
|
133 | + private function _onSave(): void { |
|
134 | 134 | /** @var FieldEntries $fields */ |
135 | 135 | if ($fields = $this->data['custom_fields'] ?? null) { |
136 | 136 | $fields->__unset(true); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
144 | - protected function _setData (array $data): void { |
|
144 | + protected function _setData(array $data): void { |
|
145 | 145 | // hearts were deprecated for likes |
146 | 146 | unset($data['hearted'], $data['hearts'], $data['num_hearts']); |
147 | 147 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @param string $file |
162 | 162 | * @return Attachment |
163 | 163 | */ |
164 | - public function addAttachment (string $file) { |
|
164 | + public function addAttachment(string $file) { |
|
165 | 165 | /** @var Attachment $attachment */ |
166 | 166 | $attachment = $this->api->factory($this, Attachment::class, ['parent' => $this]); |
167 | 167 | return $attachment->upload($file); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param string $text |
175 | 175 | * @return Story |
176 | 176 | */ |
177 | - public function addComment (string $text) { |
|
177 | + public function addComment(string $text) { |
|
178 | 178 | return $this->newComment()->setText($text)->create(); |
179 | 179 | } |
180 | 180 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @param Task[] $tasks |
186 | 186 | * @return $this |
187 | 187 | */ |
188 | - public function addDependencies (array $tasks) { |
|
188 | + public function addDependencies(array $tasks) { |
|
189 | 189 | $this->api->post("{$this}/addDependencies", ['dependents' => array_column($tasks, 'gid')]); |
190 | 190 | return $this; |
191 | 191 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @param Task $task |
198 | 198 | * @return $this |
199 | 199 | */ |
200 | - public function addDependency (Task $task) { |
|
200 | + public function addDependency(Task $task) { |
|
201 | 201 | return $this->addDependencies([$task]); |
202 | 202 | } |
203 | 203 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * @param Task $task |
209 | 209 | * @return $this |
210 | 210 | */ |
211 | - public function addDependent (Task $task) { |
|
211 | + public function addDependent(Task $task) { |
|
212 | 212 | return $this->addDependents([$task]); |
213 | 213 | } |
214 | 214 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @param Task[] $tasks |
220 | 220 | * @return $this |
221 | 221 | */ |
222 | - public function addDependents (array $tasks) { |
|
222 | + public function addDependents(array $tasks) { |
|
223 | 223 | $this->api->post("{$this}/addDependents", ['dependents' => array_column($tasks, 'gid')]); |
224 | 224 | return $this; |
225 | 225 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @param User $user |
231 | 231 | * @return $this |
232 | 232 | */ |
233 | - public function addFollower (User $user) { |
|
233 | + public function addFollower(User $user) { |
|
234 | 234 | return $this->addFollowers([$user]); |
235 | 235 | } |
236 | 236 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @param User[] $users |
243 | 243 | * @return $this |
244 | 244 | */ |
245 | - public function addFollowers (array $users) { |
|
245 | + public function addFollowers(array $users) { |
|
246 | 246 | return $this->_addWithPost("{$this}/addFollowers", [ |
247 | 247 | 'followers' => array_column($users, 'gid') |
248 | 248 | ], 'followers', $users); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @param Tag $tag |
257 | 257 | * @return $this |
258 | 258 | */ |
259 | - public function addTag (Tag $tag) { |
|
259 | + public function addTag(Tag $tag) { |
|
260 | 260 | return $this->_addWithPost("{$this}/addTag", [ |
261 | 261 | 'tag' => $tag->getGid() |
262 | 262 | ], 'tags', [$tag]); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @param Section $section |
273 | 273 | * @return $this |
274 | 274 | */ |
275 | - public function addToProject (Section $section) { |
|
275 | + public function addToProject(Section $section) { |
|
276 | 276 | /** @var Membership $membership */ |
277 | 277 | $membership = $this->api->factory($this, Membership::class) |
278 | 278 | ->_set('project', $section->getProject()) |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * @param string $target |
288 | 288 | * @return TaskWebhook |
289 | 289 | */ |
290 | - public function addWebhook (string $target) { |
|
290 | + public function addWebhook(string $target) { |
|
291 | 291 | /** @var TaskWebhook $webhook */ |
292 | 292 | $webhook = $this->api->factory($this, TaskWebhook::class); |
293 | 293 | return $webhook->create($this, $target); |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | /** |
297 | 297 | * @return $this |
298 | 298 | */ |
299 | - public function create () { |
|
299 | + public function create() { |
|
300 | 300 | $this->_create(); |
301 | 301 | $this->_onSave(); |
302 | 302 | return $this; |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * @param string[] $include |
313 | 313 | * @return Job |
314 | 314 | */ |
315 | - public function duplicate (string $name, array $include) { |
|
315 | + public function duplicate(string $name, array $include) { |
|
316 | 316 | /** @var array $remote */ |
317 | 317 | $remote = $this->api->post("{$this}/duplicate", [ |
318 | 318 | 'name' => $name, |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | * @depends after-create |
328 | 328 | * @return Attachment[] |
329 | 329 | */ |
330 | - public function getAttachments () { |
|
330 | + public function getAttachments() { |
|
331 | 331 | return $this->api->loadAll($this, Attachment::class, "{$this}/attachments"); |
332 | 332 | } |
333 | 333 | |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | * @depends after-create |
336 | 336 | * @return Story[] |
337 | 337 | */ |
338 | - public function getComments () { |
|
338 | + public function getComments() { |
|
339 | 339 | return $this->selectStories(function(Story $story) { |
340 | 340 | return $story->isComment(); |
341 | 341 | }); |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | * @depends after-create |
348 | 348 | * @return Task[] |
349 | 349 | */ |
350 | - public function getDependencies () { |
|
350 | + public function getDependencies() { |
|
351 | 351 | return $this->api->loadAll($this, self::class, "{$this}/dependencies"); |
352 | 352 | } |
353 | 353 | |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | * @depends after-create |
358 | 358 | * @return Task[] |
359 | 359 | */ |
360 | - public function getDependents () { |
|
360 | + public function getDependents() { |
|
361 | 361 | return $this->api->loadAll($this, self::class, "{$this}/dependents"); |
362 | 362 | } |
363 | 363 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * @param null|string $token |
369 | 369 | * @return Event[] |
370 | 370 | */ |
371 | - public function getEvents (&$token) { |
|
371 | + public function getEvents(&$token) { |
|
372 | 372 | return $this->api->sync($this->getGid(), $token); |
373 | 373 | } |
374 | 374 | |
@@ -383,21 +383,21 @@ discard block |
||
383 | 383 | * |
384 | 384 | * @return External |
385 | 385 | */ |
386 | - public function getExternal () { |
|
386 | + public function getExternal() { |
|
387 | 387 | return $this->_get('external') ?? $this->data['external'] = $this->api->factory($this, External::class); |
388 | 388 | } |
389 | 389 | |
390 | 390 | /** |
391 | 391 | * @return Project[] |
392 | 392 | */ |
393 | - public function getProjects () { |
|
393 | + public function getProjects() { |
|
394 | 394 | return array_column($this->getMemberships(), 'project'); |
395 | 395 | } |
396 | 396 | |
397 | 397 | /** |
398 | 398 | * @return Section[] |
399 | 399 | */ |
400 | - public function getSections () { |
|
400 | + public function getSections() { |
|
401 | 401 | return array_column($this->getMemberships(), 'section'); |
402 | 402 | } |
403 | 403 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * @depends after-create |
406 | 406 | * @return Story[] |
407 | 407 | */ |
408 | - public function getStories () { |
|
408 | + public function getStories() { |
|
409 | 409 | return $this->api->loadAll($this, Story::class, "{$this}/stories"); |
410 | 410 | } |
411 | 411 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * @depends after-create |
414 | 414 | * @return Task[] |
415 | 415 | */ |
416 | - public function getSubTasks () { |
|
416 | + public function getSubTasks() { |
|
417 | 417 | return $this->api->loadAll($this, self::class, "{$this}/subtasks"); |
418 | 418 | } |
419 | 419 | |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | * @depends after-create |
422 | 422 | * @return string |
423 | 423 | */ |
424 | - public function getUrl (): string { |
|
424 | + public function getUrl(): string { |
|
425 | 425 | return "https://app.asana.com/0/0/{$this->getGid()}"; |
426 | 426 | } |
427 | 427 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @depends after-create |
430 | 430 | * @return TaskWebhook[] |
431 | 431 | */ |
432 | - public function getWebhooks () { |
|
432 | + public function getWebhooks() { |
|
433 | 433 | return $this->api->loadAll($this, TaskWebhook::class, 'webhooks', [ |
434 | 434 | 'workspace' => $this->getWorkspace()->getGid(), |
435 | 435 | 'resource' => $this->getGid() |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | * @depends after-create |
443 | 443 | * @return Story |
444 | 444 | */ |
445 | - public function newComment () { |
|
445 | + public function newComment() { |
|
446 | 446 | return $this->api->factory($this, Story::class, [ |
447 | 447 | 'resource_subtype' => Story::TYPE_COMMENT_ADDED, |
448 | 448 | 'target' => $this |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | * @depends after-create |
456 | 456 | * @return Task |
457 | 457 | */ |
458 | - public function newSubTask () { |
|
458 | + public function newSubTask() { |
|
459 | 459 | /** @var Task $sub */ |
460 | 460 | $sub = $this->api->factory($this, self::class); |
461 | 461 | return $sub->setParent($this); |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | * @param Task[] $tasks |
469 | 469 | * @return $this |
470 | 470 | */ |
471 | - public function removeDependencies (array $tasks) { |
|
471 | + public function removeDependencies(array $tasks) { |
|
472 | 472 | $this->api->post("{$this}/removeDependencies", ['dependencies' => array_column($tasks, 'gid')]); |
473 | 473 | return $this; |
474 | 474 | } |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * @param Task $task |
481 | 481 | * @return $this |
482 | 482 | */ |
483 | - public function removeDependency (Task $task) { |
|
483 | + public function removeDependency(Task $task) { |
|
484 | 484 | return $this->removeDependencies([$task]); |
485 | 485 | } |
486 | 486 | |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | * @param Task $task |
492 | 492 | * @return $this |
493 | 493 | */ |
494 | - public function removeDependent (Task $task) { |
|
494 | + public function removeDependent(Task $task) { |
|
495 | 495 | return $this->removeDependents([$task]); |
496 | 496 | } |
497 | 497 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | * @param Task[] $tasks |
503 | 503 | * @return $this |
504 | 504 | */ |
505 | - public function removeDependents (array $tasks) { |
|
505 | + public function removeDependents(array $tasks) { |
|
506 | 506 | $this->api->post("{$this}/removeDependents", ['dependents' => array_column($tasks, 'gid')]); |
507 | 507 | return $this; |
508 | 508 | } |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | * @param User $user |
514 | 514 | * @return $this |
515 | 515 | */ |
516 | - public function removeFollower (User $user) { |
|
516 | + public function removeFollower(User $user) { |
|
517 | 517 | return $this->removeFollowers([$user]); |
518 | 518 | } |
519 | 519 | |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | * @param User[] $users |
526 | 526 | * @return $this |
527 | 527 | */ |
528 | - public function removeFollowers (array $users) { |
|
528 | + public function removeFollowers(array $users) { |
|
529 | 529 | return $this->_removeWithPost("{$this}/removeFollowers", [ |
530 | 530 | 'followers' => array_column($users, 'gid') |
531 | 531 | ], 'followers', $users); |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | * @param Project $project |
540 | 540 | * @return $this |
541 | 541 | */ |
542 | - public function removeFromProject (Project $project) { |
|
542 | + public function removeFromProject(Project $project) { |
|
543 | 543 | return $this->_removeWithPost("{$this}/removeProject", [ |
544 | 544 | 'project' => $project->getGid() |
545 | 545 | ], 'memberships', function(Membership $membership) use ($project) { |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | * @param Tag $tag |
556 | 556 | * @return $this |
557 | 557 | */ |
558 | - public function removeTag (Tag $tag) { |
|
558 | + public function removeTag(Tag $tag) { |
|
559 | 559 | return $this->_removeWithPost("{$this}/removeTag", [ |
560 | 560 | 'tag' => $tag->getGid() |
561 | 561 | ], 'tags', [$tag]); |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | * @param null|Task $parent |
569 | 569 | * @return $this |
570 | 570 | */ |
571 | - public function setParent (?self $parent) { |
|
571 | + public function setParent(?self $parent) { |
|
572 | 572 | return $this->_setWithPost("{$this}/setParent", [ |
573 | 573 | 'parent' => $parent |
574 | 574 | ], 'parent', $parent); |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | /** |
578 | 578 | * @return $this |
579 | 579 | */ |
580 | - public function update () { |
|
580 | + public function update() { |
|
581 | 581 | $this->_update(); |
582 | 582 | $this->_onSave(); |
583 | 583 | return $this; |