@@ -39,11 +39,11 @@ discard block  | 
                                                    ||
| 39 | 39 | 'workspace' => Workspace::class  | 
                                                        
| 40 | 40 | ];  | 
                                                        
| 41 | 41 | |
| 42 | -    final public function __toString (): string { | 
                                                        |
| 42 | +    final public function __toString(): string { | 
                                                        |
| 43 | 43 |          return "portfolios/{$this->getGid()}"; | 
                                                        
| 44 | 44 | }  | 
                                                        
| 45 | 45 | |
| 46 | -    final protected function _getDir (): string { | 
                                                        |
| 46 | +    final protected function _getDir(): string { | 
                                                        |
| 47 | 47 | return 'portfolios';  | 
                                                        
| 48 | 48 | }  | 
                                                        
| 49 | 49 | |
@@ -52,7 +52,7 @@ discard block  | 
                                                    ||
| 52 | 52 | * @param Project $item  | 
                                                        
| 53 | 53 | * @return $this  | 
                                                        
| 54 | 54 | */  | 
                                                        
| 55 | -    public function addItem (Project $item) { | 
                                                        |
| 55 | +    public function addItem(Project $item) { | 
                                                        |
| 56 | 56 |          $this->api->post("{$this}/addItem", ['item' => $item->getGid()]); | 
                                                        
| 57 | 57 | return $this;  | 
                                                        
| 58 | 58 | }  | 
                                                        
@@ -61,7 +61,7 @@ discard block  | 
                                                    ||
| 61 | 61 | * @param User $user  | 
                                                        
| 62 | 62 | * @return $this  | 
                                                        
| 63 | 63 | */  | 
                                                        
| 64 | -    public function addMember (User $user) { | 
                                                        |
| 64 | +    public function addMember(User $user) { | 
                                                        |
| 65 | 65 | return $this->addMembers([$user]);  | 
                                                        
| 66 | 66 | }  | 
                                                        
| 67 | 67 | |
@@ -69,7 +69,7 @@ discard block  | 
                                                    ||
| 69 | 69 | * @param User[] $users  | 
                                                        
| 70 | 70 | * @return $this  | 
                                                        
| 71 | 71 | */  | 
                                                        
| 72 | -    public function addMembers (array $users) { | 
                                                        |
| 72 | +    public function addMembers(array $users) { | 
                                                        |
| 73 | 73 |          if ($this->hasGid()) { | 
                                                        
| 74 | 74 |              $this->api->post("{$this}/addMembers", ['members' => array_column($users, 'gid')]); | 
                                                        
| 75 | 75 |              $this->_merge('members', $users); | 
                                                        
@@ -84,7 +84,7 @@ discard block  | 
                                                    ||
| 84 | 84 | * @depends after-create  | 
                                                        
| 85 | 85 | * @return Project[]  | 
                                                        
| 86 | 86 | */  | 
                                                        
| 87 | -    public function getItems () { | 
                                                        |
| 87 | +    public function getItems() { | 
                                                        |
| 88 | 88 |          return $this->loadAll(Project::class, "{$this}/items"); | 
                                                        
| 89 | 89 | }  | 
                                                        
| 90 | 90 | |
@@ -93,7 +93,7 @@ discard block  | 
                                                    ||
| 93 | 93 | * @param Project $item  | 
                                                        
| 94 | 94 | * @return $this  | 
                                                        
| 95 | 95 | */  | 
                                                        
| 96 | -    public function removeItem (Project $item) { | 
                                                        |
| 96 | +    public function removeItem(Project $item) { | 
                                                        |
| 97 | 97 |          $this->api->post("{$this}/removeItem", ['item' => $item->getGid()]); | 
                                                        
| 98 | 98 | return $this;  | 
                                                        
| 99 | 99 | }  | 
                                                        
@@ -102,7 +102,7 @@ discard block  | 
                                                    ||
| 102 | 102 | * @param User $user  | 
                                                        
| 103 | 103 | * @return $this  | 
                                                        
| 104 | 104 | */  | 
                                                        
| 105 | -    public function removeMember (User $user) { | 
                                                        |
| 105 | +    public function removeMember(User $user) { | 
                                                        |
| 106 | 106 | return $this->removeMembers([$user]);  | 
                                                        
| 107 | 107 | }  | 
                                                        
| 108 | 108 | |
@@ -110,7 +110,7 @@ discard block  | 
                                                    ||
| 110 | 110 | * @param User[] $users  | 
                                                        
| 111 | 111 | * @return $this  | 
                                                        
| 112 | 112 | */  | 
                                                        
| 113 | -    public function removeMembers (array $users) { | 
                                                        |
| 113 | +    public function removeMembers(array $users) { | 
                                                        |
| 114 | 114 |          if ($this->hasGid()) { | 
                                                        
| 115 | 115 |              $this->api->post("{$this}/removeMembers", ['members' => array_column($users, 'gid')]); | 
                                                        
| 116 | 116 | }  | 
                                                        
@@ -73,8 +73,7 @@  | 
                                                    ||
| 73 | 73 |          if ($this->hasGid()) { | 
                                                        
| 74 | 74 |              $this->api->post("{$this}/addMembers", ['members' => array_column($users, 'gid')]); | 
                                                        
| 75 | 75 |              $this->_merge('members', $users); | 
                                                        
| 76 | - }  | 
                                                        |
| 77 | -        else { | 
                                                        |
| 76 | +        } else { | 
                                                        |
| 78 | 77 |              $this->_merge('members', $users, true); | 
                                                        
| 79 | 78 | }  | 
                                                        
| 80 | 79 | return $this;  | 
                                                        
@@ -16,7 +16,7 @@ discard block  | 
                                                    ||
| 16 | 16 | *  | 
                                                        
| 17 | 17 | * @return string  | 
                                                        
| 18 | 18 | */  | 
                                                        
| 19 | - abstract public function __toString (): string;  | 
                                                        |
| 19 | + abstract public function __toString(): string;  | 
                                                        |
| 20 | 20 | |
| 21 | 21 | /**  | 
                                                        
| 22 | 22 | * Maps lazy-loaded / reloadable fields to their proper expanded field expression.  | 
                                                        
@@ -33,7 +33,7 @@ discard block  | 
                                                    ||
| 33 | 33 | * @param string $key  | 
                                                        
| 34 | 34 | * @return mixed  | 
                                                        
| 35 | 35 | */  | 
                                                        
| 36 | -    protected function _get (string $key) { | 
                                                        |
| 36 | +    protected function _get(string $key) { | 
                                                        |
| 37 | 37 |          if (!array_key_exists($key, $this->data) and isset($this->data['gid'])) { // can't use hasGid(), inf. loop | 
                                                        
| 38 | 38 | $this->reload($key);  | 
                                                        
| 39 | 39 | }  | 
                                                        
@@ -48,7 +48,7 @@ discard block  | 
                                                    ||
| 48 | 48 | * @param bool $force  | 
                                                        
| 49 | 49 | * @return $this  | 
                                                        
| 50 | 50 | */  | 
                                                        
| 51 | -    protected function _merge (string $key, array $entities, $force = false) { | 
                                                        |
| 51 | +    protected function _merge(string $key, array $entities, $force = false) { | 
                                                        |
| 52 | 52 |          if ($force or isset($this->data[$key])) { | 
                                                        
| 53 | 53 |              foreach ($entities as $entity) { | 
                                                        
| 54 | 54 | $this->data[$key][] = $entity;  | 
                                                        
@@ -71,7 +71,7 @@ discard block  | 
                                                    ||
| 71 | 71 | * @param AbstractEntity[] $entities  | 
                                                        
| 72 | 72 | * @return $this  | 
                                                        
| 73 | 73 | */  | 
                                                        
| 74 | -    protected function _remove (string $key, array $entities) { | 
                                                        |
| 74 | +    protected function _remove(string $key, array $entities) { | 
                                                        |
| 75 | 75 |          if (isset($this->data[$key])) { | 
                                                        
| 76 | 76 | $this->data[$key] = array_values(array_diff($this->data[$key], $entities));  | 
                                                        
| 77 | 77 | $this->api->getCache()->add($this);  | 
                                                        
@@ -85,7 +85,7 @@ discard block  | 
                                                    ||
| 85 | 85 | * @param AbstractEntity $entity  | 
                                                        
| 86 | 86 | * @return $this  | 
                                                        
| 87 | 87 | */  | 
                                                        
| 88 | -    public function merge (AbstractEntity $entity) { | 
                                                        |
| 88 | +    public function merge(AbstractEntity $entity) { | 
                                                        |
| 89 | 89 | assert($entity->api); // hydrated  | 
                                                        
| 90 | 90 |          foreach ($entity->data as $key => $value) { | 
                                                        
| 91 | 91 |              if (!array_key_exists($key, $this->data) and !isset($entity->diff[$key])) { | 
                                                        
@@ -101,7 +101,7 @@ discard block  | 
                                                    ||
| 101 | 101 | * @param string $key  | 
                                                        
| 102 | 102 | * @return $this  | 
                                                        
| 103 | 103 | */  | 
                                                        
| 104 | -    public function reload (string $key = null) { | 
                                                        |
| 104 | +    public function reload(string $key = null) { | 
                                                        |
| 105 | 105 |          if (isset($key)) { | 
                                                        
| 106 | 106 | $value = $this->api->get($this, [], ['fields' => static::$optFields[$key] ?? $key])[$key] ?? null;  | 
                                                        
| 107 | 107 | $this->_setMapped($key, $value);  | 
                                                        
@@ -95,14 +95,14 @@ discard block  | 
                                                    ||
| 95 | 95 | 'memberships' => 'memberships.(project|section)'  | 
                                                        
| 96 | 96 | ];  | 
                                                        
| 97 | 97 | |
| 98 | -    final public function __toString (): string { | 
                                                        |
| 98 | +    final public function __toString(): string { | 
                                                        |
| 99 | 99 |          return "tasks/{$this->getGid()}"; | 
                                                        
| 100 | 100 | }  | 
                                                        
| 101 | 101 | |
| 102 | 102 | /**  | 
                                                        
| 103 | 103 | * Clears the diffs for `custom_fields` and `external` sub-objects after saving.  | 
                                                        
| 104 | 104 | */  | 
                                                        
| 105 | -    protected function _clearSubDiffs (): void { | 
                                                        |
| 105 | +    protected function _clearSubDiffs(): void { | 
                                                        |
| 106 | 106 | // use isset() to avoid has() fetch.  | 
                                                        
| 107 | 107 |          if (isset($this->data['custom_fields'])) { | 
                                                        
| 108 | 108 | $this->getCustomFields()->diff = [];  | 
                                                        
@@ -112,7 +112,7 @@ discard block  | 
                                                    ||
| 112 | 112 | }  | 
                                                        
| 113 | 113 | }  | 
                                                        
| 114 | 114 | |
| 115 | -    final protected function _getDir (): string { | 
                                                        |
| 115 | +    final protected function _getDir(): string { | 
                                                        |
| 116 | 116 | return 'tasks';  | 
                                                        
| 117 | 117 | }  | 
                                                        
| 118 | 118 | |
@@ -123,7 +123,7 @@ discard block  | 
                                                    ||
| 123 | 123 | * @param string $file  | 
                                                        
| 124 | 124 | * @return Attachment  | 
                                                        
| 125 | 125 | */  | 
                                                        
| 126 | -    public function addAttachment (string $file) { | 
                                                        |
| 126 | +    public function addAttachment(string $file) { | 
                                                        |
| 127 | 127 | /** @var Attachment $attachment */  | 
                                                        
| 128 | 128 | $attachment = $this->factory(Attachment::class, ['parent' => $this]);  | 
                                                        
| 129 | 129 | return $attachment->upload($file);  | 
                                                        
@@ -135,7 +135,7 @@ discard block  | 
                                                    ||
| 135 | 135 | * @param string $text  | 
                                                        
| 136 | 136 | * @return Story  | 
                                                        
| 137 | 137 | */  | 
                                                        
| 138 | -    public function addComment (string $text) { | 
                                                        |
| 138 | +    public function addComment(string $text) { | 
                                                        |
| 139 | 139 | return $this->newComment()->setText($text)->create();  | 
                                                        
| 140 | 140 | }  | 
                                                        
| 141 | 141 | |
@@ -146,7 +146,7 @@ discard block  | 
                                                    ||
| 146 | 146 | * @param Task[] $tasks  | 
                                                        
| 147 | 147 | * @return $this  | 
                                                        
| 148 | 148 | */  | 
                                                        
| 149 | -    public function addDependencies (array $tasks) { | 
                                                        |
| 149 | +    public function addDependencies(array $tasks) { | 
                                                        |
| 150 | 150 |          $this->api->post("{$this}/addDependencies", ['dependents' => array_column($tasks, 'gid')]); | 
                                                        
| 151 | 151 | return $this;  | 
                                                        
| 152 | 152 | }  | 
                                                        
@@ -158,7 +158,7 @@ discard block  | 
                                                    ||
| 158 | 158 | * @param Task $task  | 
                                                        
| 159 | 159 | * @return $this  | 
                                                        
| 160 | 160 | */  | 
                                                        
| 161 | -    public function addDependency (Task $task) { | 
                                                        |
| 161 | +    public function addDependency(Task $task) { | 
                                                        |
| 162 | 162 | return $this->addDependencies([$task]);  | 
                                                        
| 163 | 163 | }  | 
                                                        
| 164 | 164 | |
@@ -169,7 +169,7 @@ discard block  | 
                                                    ||
| 169 | 169 | * @param Task $task  | 
                                                        
| 170 | 170 | * @return $this  | 
                                                        
| 171 | 171 | */  | 
                                                        
| 172 | -    public function addDependent (Task $task) { | 
                                                        |
| 172 | +    public function addDependent(Task $task) { | 
                                                        |
| 173 | 173 | return $this->addDependents([$task]);  | 
                                                        
| 174 | 174 | }  | 
                                                        
| 175 | 175 | |
@@ -180,7 +180,7 @@ discard block  | 
                                                    ||
| 180 | 180 | * @param Task[] $tasks  | 
                                                        
| 181 | 181 | * @return $this  | 
                                                        
| 182 | 182 | */  | 
                                                        
| 183 | -    public function addDependents (array $tasks) { | 
                                                        |
| 183 | +    public function addDependents(array $tasks) { | 
                                                        |
| 184 | 184 |          $this->api->post("{$this}/addDependents", ['dependents' => array_column($tasks, 'gid')]); | 
                                                        
| 185 | 185 | return $this;  | 
                                                        
| 186 | 186 | }  | 
                                                        
@@ -191,7 +191,7 @@ discard block  | 
                                                    ||
| 191 | 191 | * @param User $user  | 
                                                        
| 192 | 192 | * @return $this  | 
                                                        
| 193 | 193 | */  | 
                                                        
| 194 | -    public function addFollower (User $user) { | 
                                                        |
| 194 | +    public function addFollower(User $user) { | 
                                                        |
| 195 | 195 | return $this->addFollowers([$user]);  | 
                                                        
| 196 | 196 | }  | 
                                                        
| 197 | 197 | |
@@ -201,7 +201,7 @@ discard block  | 
                                                    ||
| 201 | 201 | * @param User[] $users  | 
                                                        
| 202 | 202 | * @return $this  | 
                                                        
| 203 | 203 | */  | 
                                                        
| 204 | -    public function addFollowers (array $users) { | 
                                                        |
| 204 | +    public function addFollowers(array $users) { | 
                                                        |
| 205 | 205 |          if ($this->hasGid()) { | 
                                                        
| 206 | 206 |              $this->api->post("{$this}/addFollowers", ['followers' => array_column($users, 'gid')]); | 
                                                        
| 207 | 207 |              $this->_merge('followers', $users); | 
                                                        
@@ -218,7 +218,7 @@ discard block  | 
                                                    ||
| 218 | 218 | * @param Tag $tag  | 
                                                        
| 219 | 219 | * @return $this  | 
                                                        
| 220 | 220 | */  | 
                                                        
| 221 | -    public function addTag (Tag $tag) { | 
                                                        |
| 221 | +    public function addTag(Tag $tag) { | 
                                                        |
| 222 | 222 |          if ($this->hasGid()) { | 
                                                        
| 223 | 223 |              $this->api->post("{$this}/addTag", ['tag' => $tag->getGid()]); | 
                                                        
| 224 | 224 |              $this->_merge('tags', [$tag]); | 
                                                        
@@ -235,7 +235,7 @@ discard block  | 
                                                    ||
| 235 | 235 | * @param Section $section  | 
                                                        
| 236 | 236 | * @return $this  | 
                                                        
| 237 | 237 | */  | 
                                                        
| 238 | -    public function addToProject (Section $section) { | 
                                                        |
| 238 | +    public function addToProject(Section $section) { | 
                                                        |
| 239 | 239 | $project = $section->getProject();  | 
                                                        
| 240 | 240 |          if ($this->hasGid()) { | 
                                                        
| 241 | 241 |              $this->api->post("{$this}/addProject", [ | 
                                                        
@@ -269,7 +269,7 @@ discard block  | 
                                                    ||
| 269 | 269 | * @param string $target  | 
                                                        
| 270 | 270 | * @return TaskWebhook  | 
                                                        
| 271 | 271 | */  | 
                                                        
| 272 | -    public function addWebhook (string $target) { | 
                                                        |
| 272 | +    public function addWebhook(string $target) { | 
                                                        |
| 273 | 273 | /** @var TaskWebhook $webhook */  | 
                                                        
| 274 | 274 | $webhook = $this->factory(TaskWebhook::class);  | 
                                                        
| 275 | 275 | return $webhook->create($this, $target);  | 
                                                        
@@ -278,7 +278,7 @@ discard block  | 
                                                    ||
| 278 | 278 | /**  | 
                                                        
| 279 | 279 | * @return $this  | 
                                                        
| 280 | 280 | */  | 
                                                        
| 281 | -    public function create () { | 
                                                        |
| 281 | +    public function create() { | 
                                                        |
| 282 | 282 | $this->_create();  | 
                                                        
| 283 | 283 | $this->_clearSubDiffs();  | 
                                                        
| 284 | 284 | return $this;  | 
                                                        
@@ -294,7 +294,7 @@ discard block  | 
                                                    ||
| 294 | 294 | * @param string[] $include  | 
                                                        
| 295 | 295 | * @return Job  | 
                                                        
| 296 | 296 | */  | 
                                                        
| 297 | -    public function duplicate (string $name, array $include) { | 
                                                        |
| 297 | +    public function duplicate(string $name, array $include) { | 
                                                        |
| 298 | 298 |          $remote = $this->api->post("{$this}/duplicate", [ | 
                                                        
| 299 | 299 | 'name' => $name,  | 
                                                        
| 300 | 300 | 'include' => array_values($include)  | 
                                                        
@@ -308,7 +308,7 @@ discard block  | 
                                                    ||
| 308 | 308 | * @depends after-create  | 
                                                        
| 309 | 309 | * @return Attachment[]  | 
                                                        
| 310 | 310 | */  | 
                                                        
| 311 | -    public function getAttachments () { | 
                                                        |
| 311 | +    public function getAttachments() { | 
                                                        |
| 312 | 312 |          return $this->loadAll(Attachment::class, "{$this}/attachments"); | 
                                                        
| 313 | 313 | }  | 
                                                        
| 314 | 314 | |
@@ -318,7 +318,7 @@ discard block  | 
                                                    ||
| 318 | 318 | * @depends after-create  | 
                                                        
| 319 | 319 | * @return Story[]  | 
                                                        
| 320 | 320 | */  | 
                                                        
| 321 | -    public function getComments () { | 
                                                        |
| 321 | +    public function getComments() { | 
                                                        |
| 322 | 322 |          return array_values(array_filter($this->getStories(), function(Story $story) { | 
                                                        
| 323 | 323 | return $story->isComment();  | 
                                                        
| 324 | 324 | }));  | 
                                                        
@@ -330,7 +330,7 @@ discard block  | 
                                                    ||
| 330 | 330 | * @depends after-create  | 
                                                        
| 331 | 331 | * @return Task[]  | 
                                                        
| 332 | 332 | */  | 
                                                        
| 333 | -    public function getDependencies () { | 
                                                        |
| 333 | +    public function getDependencies() { | 
                                                        |
| 334 | 334 |          return $this->loadAll(self::class, "{$this}/dependencies"); | 
                                                        
| 335 | 335 | }  | 
                                                        
| 336 | 336 | |
@@ -340,7 +340,7 @@ discard block  | 
                                                    ||
| 340 | 340 | * @depends after-create  | 
                                                        
| 341 | 341 | * @return Task[]  | 
                                                        
| 342 | 342 | */  | 
                                                        
| 343 | -    public function getDependents () { | 
                                                        |
| 343 | +    public function getDependents() { | 
                                                        |
| 344 | 344 |          return $this->loadAll(self::class, "{$this}/dependents"); | 
                                                        
| 345 | 345 | }  | 
                                                        
| 346 | 346 | |
@@ -351,21 +351,21 @@ discard block  | 
                                                    ||
| 351 | 351 | * @param null|string $token  | 
                                                        
| 352 | 352 | * @return TaskEvent[]|StoryEvent[]  | 
                                                        
| 353 | 353 | */  | 
                                                        
| 354 | -    public function getEvents (&$token) { | 
                                                        |
| 354 | +    public function getEvents(&$token) { | 
                                                        |
| 355 | 355 | return $this->api->sync($this, $token);  | 
                                                        
| 356 | 356 | }  | 
                                                        
| 357 | 357 | |
| 358 | 358 | /**  | 
                                                        
| 359 | 359 | * @return External  | 
                                                        
| 360 | 360 | */  | 
                                                        
| 361 | -    public function getExternal () { | 
                                                        |
| 361 | +    public function getExternal() { | 
                                                        |
| 362 | 362 |          return $this->_get('external') ?? $this->data['external'] = $this->factory(static::$map['external']); | 
                                                        
| 363 | 363 | }  | 
                                                        
| 364 | 364 | |
| 365 | 365 | /**  | 
                                                        
| 366 | 366 | * @return Project[]  | 
                                                        
| 367 | 367 | */  | 
                                                        
| 368 | -    public function getProjects () { | 
                                                        |
| 368 | +    public function getProjects() { | 
                                                        |
| 369 | 369 |          return array_map(function(Membership $membership) { | 
                                                        
| 370 | 370 | return $membership->getProject();  | 
                                                        
| 371 | 371 | }, $this->getMemberships());  | 
                                                        
@@ -377,7 +377,7 @@ discard block  | 
                                                    ||
| 377 | 377 | * @depends after-create  | 
                                                        
| 378 | 378 | * @return Story[]  | 
                                                        
| 379 | 379 | */  | 
                                                        
| 380 | -    public function getStories () { | 
                                                        |
| 380 | +    public function getStories() { | 
                                                        |
| 381 | 381 |          return $this->loadAll(Story::class, "{$this}/stories"); | 
                                                        
| 382 | 382 | }  | 
                                                        
| 383 | 383 | |
@@ -387,7 +387,7 @@ discard block  | 
                                                    ||
| 387 | 387 | * @depends after-create  | 
                                                        
| 388 | 388 | * @return Task[]  | 
                                                        
| 389 | 389 | */  | 
                                                        
| 390 | -    public function getSubTasks () { | 
                                                        |
| 390 | +    public function getSubTasks() { | 
                                                        |
| 391 | 391 |          return $this->loadAll(self::class, "{$this}/subtasks"); | 
                                                        
| 392 | 392 | }  | 
                                                        
| 393 | 393 | |
@@ -397,7 +397,7 @@ discard block  | 
                                                    ||
| 397 | 397 | * @depends after-create  | 
                                                        
| 398 | 398 | * @return string  | 
                                                        
| 399 | 399 | */  | 
                                                        
| 400 | -    public function getUrl (): string { | 
                                                        |
| 400 | +    public function getUrl(): string { | 
                                                        |
| 401 | 401 |          return "https://app.asana.com/0/0/{$this->getGid()}"; | 
                                                        
| 402 | 402 | }  | 
                                                        
| 403 | 403 | |
@@ -407,7 +407,7 @@ discard block  | 
                                                    ||
| 407 | 407 | * @depends after-create  | 
                                                        
| 408 | 408 | * @return TaskWebhook[]  | 
                                                        
| 409 | 409 | */  | 
                                                        
| 410 | -    public function getWebhooks () { | 
                                                        |
| 410 | +    public function getWebhooks() { | 
                                                        |
| 411 | 411 | return $this->loadAll(TaskWebhook::class, 'webhooks', [  | 
                                                        
| 412 | 412 | 'workspace' => $this->getWorkspace()->getGid(),  | 
                                                        
| 413 | 413 | 'resource' => $this->getGid()  | 
                                                        
@@ -417,7 +417,7 @@ discard block  | 
                                                    ||
| 417 | 417 | /**  | 
                                                        
| 418 | 418 | * @return bool  | 
                                                        
| 419 | 419 | */  | 
                                                        
| 420 | -    public function isRenderedAsSeparator (): bool { | 
                                                        |
| 420 | +    public function isRenderedAsSeparator(): bool { | 
                                                        |
| 421 | 421 |          return $this->_is('is_rendered_as_separator'); | 
                                                        
| 422 | 422 | }  | 
                                                        
| 423 | 423 | |
@@ -427,7 +427,7 @@ discard block  | 
                                                    ||
| 427 | 427 | * @depends after-create  | 
                                                        
| 428 | 428 | * @return Story  | 
                                                        
| 429 | 429 | */  | 
                                                        
| 430 | -    public function newComment () { | 
                                                        |
| 430 | +    public function newComment() { | 
                                                        |
| 431 | 431 | /** @var Story $comment */  | 
                                                        
| 432 | 432 | $comment = $this->factory(Story::class, [  | 
                                                        
| 433 | 433 | 'resource_subtype' => Story::TYPE_COMMENT_ADDED  | 
                                                        
@@ -441,7 +441,7 @@ discard block  | 
                                                    ||
| 441 | 441 | * @depends after-create  | 
                                                        
| 442 | 442 | * @return Task  | 
                                                        
| 443 | 443 | */  | 
                                                        
| 444 | -    public function newSubTask () { | 
                                                        |
| 444 | +    public function newSubTask() { | 
                                                        |
| 445 | 445 | /** @var Task $sub */  | 
                                                        
| 446 | 446 | $sub = $this->factory(self::class);  | 
                                                        
| 447 | 447 | return $sub->setParent($this);  | 
                                                        
@@ -454,7 +454,7 @@ discard block  | 
                                                    ||
| 454 | 454 | * @param Task[] $tasks  | 
                                                        
| 455 | 455 | * @return $this  | 
                                                        
| 456 | 456 | */  | 
                                                        
| 457 | -    public function removeDependencies (array $tasks) { | 
                                                        |
| 457 | +    public function removeDependencies(array $tasks) { | 
                                                        |
| 458 | 458 |          $this->api->post("{$this}/removeDependencies", ['dependencies' => array_column($tasks, 'gid')]); | 
                                                        
| 459 | 459 | return $this;  | 
                                                        
| 460 | 460 | }  | 
                                                        
@@ -466,7 +466,7 @@ discard block  | 
                                                    ||
| 466 | 466 | * @param Task $task  | 
                                                        
| 467 | 467 | * @return $this  | 
                                                        
| 468 | 468 | */  | 
                                                        
| 469 | -    public function removeDependency (Task $task) { | 
                                                        |
| 469 | +    public function removeDependency(Task $task) { | 
                                                        |
| 470 | 470 | return $this->removeDependencies([$task]);  | 
                                                        
| 471 | 471 | }  | 
                                                        
| 472 | 472 | |
@@ -477,7 +477,7 @@ discard block  | 
                                                    ||
| 477 | 477 | * @param Task $task  | 
                                                        
| 478 | 478 | * @return $this  | 
                                                        
| 479 | 479 | */  | 
                                                        
| 480 | -    public function removeDependent (Task $task) { | 
                                                        |
| 480 | +    public function removeDependent(Task $task) { | 
                                                        |
| 481 | 481 | return $this->removeDependents([$task]);  | 
                                                        
| 482 | 482 | }  | 
                                                        
| 483 | 483 | |
@@ -488,7 +488,7 @@ discard block  | 
                                                    ||
| 488 | 488 | * @param Task[] $tasks  | 
                                                        
| 489 | 489 | * @return $this  | 
                                                        
| 490 | 490 | */  | 
                                                        
| 491 | -    public function removeDependents (array $tasks) { | 
                                                        |
| 491 | +    public function removeDependents(array $tasks) { | 
                                                        |
| 492 | 492 |          $this->api->post("{$this}/removeDependents", ['dependents' => array_column($tasks, 'gid')]); | 
                                                        
| 493 | 493 | return $this;  | 
                                                        
| 494 | 494 | }  | 
                                                        
@@ -499,7 +499,7 @@ discard block  | 
                                                    ||
| 499 | 499 | * @param User $user  | 
                                                        
| 500 | 500 | * @return $this  | 
                                                        
| 501 | 501 | */  | 
                                                        
| 502 | -    public function removeFollower (User $user) { | 
                                                        |
| 502 | +    public function removeFollower(User $user) { | 
                                                        |
| 503 | 503 | return $this->removeFollowers([$user]);  | 
                                                        
| 504 | 504 | }  | 
                                                        
| 505 | 505 | |
@@ -509,7 +509,7 @@ discard block  | 
                                                    ||
| 509 | 509 | * @param User[] $users  | 
                                                        
| 510 | 510 | * @return $this  | 
                                                        
| 511 | 511 | */  | 
                                                        
| 512 | -    public function removeFollowers (array $users) { | 
                                                        |
| 512 | +    public function removeFollowers(array $users) { | 
                                                        |
| 513 | 513 |          if ($this->hasGid()) { | 
                                                        
| 514 | 514 |              $this->api->post("{$this}/removeFollowers", ['followers' => array_column($users, 'gid')]); | 
                                                        
| 515 | 515 | }  | 
                                                        
@@ -523,7 +523,7 @@ discard block  | 
                                                    ||
| 523 | 523 | * @param Project $project  | 
                                                        
| 524 | 524 | * @return $this  | 
                                                        
| 525 | 525 | */  | 
                                                        
| 526 | -    public function removeFromProject (Project $project) { | 
                                                        |
| 526 | +    public function removeFromProject(Project $project) { | 
                                                        |
| 527 | 527 | $gid = $project->getGid();  | 
                                                        
| 528 | 528 |          if ($this->hasGid()) { | 
                                                        
| 529 | 529 |              $this->api->post("{$this}/removeProject", ['project' => $gid]); | 
                                                        
@@ -542,7 +542,7 @@ discard block  | 
                                                    ||
| 542 | 542 | * @param Tag $tag  | 
                                                        
| 543 | 543 | * @return $this  | 
                                                        
| 544 | 544 | */  | 
                                                        
| 545 | -    public function removeTag (Tag $tag) { | 
                                                        |
| 545 | +    public function removeTag(Tag $tag) { | 
                                                        |
| 546 | 546 |          if ($this->hasGid()) { | 
                                                        
| 547 | 547 |              $this->api->post("{$this}/removeTag", ['tag' => $tag->getGid()]); | 
                                                        
| 548 | 548 | }  | 
                                                        
@@ -556,7 +556,7 @@ discard block  | 
                                                    ||
| 556 | 556 | * @param null|Task $parent  | 
                                                        
| 557 | 557 | * @return $this  | 
                                                        
| 558 | 558 | */  | 
                                                        
| 559 | -    public function setParent (?self $parent) { | 
                                                        |
| 559 | +    public function setParent(?self $parent) { | 
                                                        |
| 560 | 560 |          if ($this->hasGid()) { | 
                                                        
| 561 | 561 |              $this->api->post("{$this}/setParent", ['parent' => $parent ? $parent->getGid() : null]); | 
                                                        
| 562 | 562 | $this->data['parent'] = $parent;  | 
                                                        
@@ -571,14 +571,14 @@ discard block  | 
                                                    ||
| 571 | 571 | * @param bool $flag  | 
                                                        
| 572 | 572 | * @return $this  | 
                                                        
| 573 | 573 | */  | 
                                                        
| 574 | -    public function setRenderedAsSeparator (bool $flag) { | 
                                                        |
| 574 | +    public function setRenderedAsSeparator(bool $flag) { | 
                                                        |
| 575 | 575 |          return $this->_set('is_rendered_as_separator', $flag); | 
                                                        
| 576 | 576 | }  | 
                                                        
| 577 | 577 | |
| 578 | 578 | /**  | 
                                                        
| 579 | 579 | * @return $this  | 
                                                        
| 580 | 580 | */  | 
                                                        
| 581 | -    public function update () { | 
                                                        |
| 581 | +    public function update() { | 
                                                        |
| 582 | 582 | $this->_update();  | 
                                                        
| 583 | 583 | $this->_clearSubDiffs();  | 
                                                        
| 584 | 584 | return $this;  | 
                                                        
@@ -205,8 +205,7 @@ discard block  | 
                                                    ||
| 205 | 205 |          if ($this->hasGid()) { | 
                                                        
| 206 | 206 |              $this->api->post("{$this}/addFollowers", ['followers' => array_column($users, 'gid')]); | 
                                                        
| 207 | 207 |              $this->_merge('followers', $users); | 
                                                        
| 208 | - }  | 
                                                        |
| 209 | -        else { | 
                                                        |
| 208 | +        } else { | 
                                                        |
| 210 | 209 |              $this->_merge('followers', $users, true); | 
                                                        
| 211 | 210 | }  | 
                                                        
| 212 | 211 | return $this;  | 
                                                        
@@ -222,8 +221,7 @@ discard block  | 
                                                    ||
| 222 | 221 |          if ($this->hasGid()) { | 
                                                        
| 223 | 222 |              $this->api->post("{$this}/addTag", ['tag' => $tag->getGid()]); | 
                                                        
| 224 | 223 |              $this->_merge('tags', [$tag]); | 
                                                        
| 225 | - }  | 
                                                        |
| 226 | -        else { | 
                                                        |
| 224 | +        } else { | 
                                                        |
| 227 | 225 |              $this->_merge('tags', [$tag], true); | 
                                                        
| 228 | 226 | }  | 
                                                        
| 229 | 227 | return $this;  | 
                                                        
@@ -248,8 +246,7 @@ discard block  | 
                                                    ||
| 248 | 246 | 'section' => $section  | 
                                                        
| 249 | 247 | ]);  | 
                                                        
| 250 | 248 | }  | 
                                                        
| 251 | - }  | 
                                                        |
| 252 | -        else { | 
                                                        |
| 249 | +        } else { | 
                                                        |
| 253 | 250 |              if (!$this->hasWorkspace()) { | 
                                                        
| 254 | 251 | $this->setWorkspace($project->getWorkspace());  | 
                                                        
| 255 | 252 | }  | 
                                                        
@@ -560,8 +557,7 @@ discard block  | 
                                                    ||
| 560 | 557 |          if ($this->hasGid()) { | 
                                                        
| 561 | 558 |              $this->api->post("{$this}/setParent", ['parent' => $parent ? $parent->getGid() : null]); | 
                                                        
| 562 | 559 | $this->data['parent'] = $parent;  | 
                                                        
| 563 | - }  | 
                                                        |
| 564 | -        else { | 
                                                        |
| 560 | +        } else { | 
                                                        |
| 565 | 561 |              $this->_set('parent', $parent); | 
                                                        
| 566 | 562 | }  | 
                                                        
| 567 | 563 | return $this;  | 
                                                        
@@ -67,11 +67,11 @@ discard block  | 
                                                    ||
| 67 | 67 | 'workspace' => Workspace::class  | 
                                                        
| 68 | 68 | ];  | 
                                                        
| 69 | 69 | |
| 70 | -    final public function __toString (): string { | 
                                                        |
| 70 | +    final public function __toString(): string { | 
                                                        |
| 71 | 71 |          return "projects/{$this->getGid()}"; | 
                                                        
| 72 | 72 | }  | 
                                                        
| 73 | 73 | |
| 74 | -    final protected function _getDir (): string { | 
                                                        |
| 74 | +    final protected function _getDir(): string { | 
                                                        |
| 75 | 75 | return 'projects';  | 
                                                        
| 76 | 76 | }  | 
                                                        
| 77 | 77 | |
@@ -80,7 +80,7 @@ discard block  | 
                                                    ||
| 80 | 80 | * @param User $user  | 
                                                        
| 81 | 81 | * @return $this  | 
                                                        
| 82 | 82 | */  | 
                                                        
| 83 | -    public function addMember (User $user) { | 
                                                        |
| 83 | +    public function addMember(User $user) { | 
                                                        |
| 84 | 84 | return $this->addMembers([$user]);  | 
                                                        
| 85 | 85 | }  | 
                                                        
| 86 | 86 | |
@@ -89,7 +89,7 @@ discard block  | 
                                                    ||
| 89 | 89 | * @param User[] $users  | 
                                                        
| 90 | 90 | * @return $this  | 
                                                        
| 91 | 91 | */  | 
                                                        
| 92 | -    public function addMembers (array $users) { | 
                                                        |
| 92 | +    public function addMembers(array $users) { | 
                                                        |
| 93 | 93 |          $this->api->post("{$this}/addMembers", ['members' => array_column($users, 'gid')]); | 
                                                        
| 94 | 94 |          $this->_merge('members', $users); | 
                                                        
| 95 | 95 | return $this;  | 
                                                        
@@ -100,7 +100,7 @@ discard block  | 
                                                    ||
| 100 | 100 | * @param string $target  | 
                                                        
| 101 | 101 | * @return ProjectWebhook  | 
                                                        
| 102 | 102 | */  | 
                                                        
| 103 | -    public function addWebhook (string $target) { | 
                                                        |
| 103 | +    public function addWebhook(string $target) { | 
                                                        |
| 104 | 104 | /** @var ProjectWebhook $webhook */  | 
                                                        
| 105 | 105 | $webhook = $this->factory(ProjectWebhook::class);  | 
                                                        
| 106 | 106 | return $webhook->create($this, $target);  | 
                                                        
@@ -125,7 +125,7 @@ discard block  | 
                                                    ||
| 125 | 125 | * @param array $schedule  | 
                                                        
| 126 | 126 | * @return Job  | 
                                                        
| 127 | 127 | */  | 
                                                        
| 128 | -    public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) { | 
                                                        |
| 128 | +    public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) { | 
                                                        |
| 129 | 129 | $data = ['name' => $name];  | 
                                                        
| 130 | 130 |          if ($team) { | 
                                                        
| 131 | 131 | $data['team'] = $team->getGid();  | 
                                                        
@@ -147,7 +147,7 @@ discard block  | 
                                                    ||
| 147 | 147 | * @param null|string $token  | 
                                                        
| 148 | 148 | * @return ProjectEvent[]|TaskEvent[]|StoryEvent[]  | 
                                                        
| 149 | 149 | */  | 
                                                        
| 150 | -    public function getEvents (&$token) { | 
                                                        |
| 150 | +    public function getEvents(&$token) { | 
                                                        |
| 151 | 151 | return $this->api->sync($this, $token);  | 
                                                        
| 152 | 152 | }  | 
                                                        
| 153 | 153 | |
@@ -155,7 +155,7 @@ discard block  | 
                                                    ||
| 155 | 155 | * @depends after-create  | 
                                                        
| 156 | 156 | * @return Section[]  | 
                                                        
| 157 | 157 | */  | 
                                                        
| 158 | -    public function getSections () { | 
                                                        |
| 158 | +    public function getSections() { | 
                                                        |
| 159 | 159 |          return $this->loadAll(Section::class, "{$this}/sections"); | 
                                                        
| 160 | 160 | }  | 
                                                        
| 161 | 161 | |
@@ -163,7 +163,7 @@ discard block  | 
                                                    ||
| 163 | 163 | * @depends after-create  | 
                                                        
| 164 | 164 | * @return Status[]  | 
                                                        
| 165 | 165 | */  | 
                                                        
| 166 | -    public function getStatuses () { | 
                                                        |
| 166 | +    public function getStatuses() { | 
                                                        |
| 167 | 167 |          return $this->loadAll(Status::class, "{$this}/project_statuses"); | 
                                                        
| 168 | 168 | }  | 
                                                        
| 169 | 169 | |
@@ -172,7 +172,7 @@ discard block  | 
                                                    ||
| 172 | 172 | * @param array $query  | 
                                                        
| 173 | 173 | * @return Task[]  | 
                                                        
| 174 | 174 | */  | 
                                                        
| 175 | -    public function getTasks (array $query = []) { | 
                                                        |
| 175 | +    public function getTasks(array $query = []) { | 
                                                        |
| 176 | 176 | $query['project'] = $this->getGid();  | 
                                                        
| 177 | 177 | return $this->loadAll(Task::class, "tasks", $query);  | 
                                                        
| 178 | 178 | }  | 
                                                        
@@ -181,25 +181,25 @@ discard block  | 
                                                    ||
| 181 | 181 | * @depends after-create  | 
                                                        
| 182 | 182 | * @return string  | 
                                                        
| 183 | 183 | */  | 
                                                        
| 184 | -    public function getUrl (): string { | 
                                                        |
| 184 | +    public function getUrl(): string { | 
                                                        |
| 185 | 185 |          return "https://app.asana.com/0/{$this->getGid()}"; | 
                                                        
| 186 | 186 | }  | 
                                                        
| 187 | 187 | |
| 188 | 188 | /**  | 
                                                        
| 189 | 189 | * @return ProjectWebhook[]  | 
                                                        
| 190 | 190 | */  | 
                                                        
| 191 | -    public function getWebhooks () { | 
                                                        |
| 191 | +    public function getWebhooks() { | 
                                                        |
| 192 | 192 | return $this->loadAll(ProjectWebhook::class, 'webhooks', [  | 
                                                        
| 193 | 193 | 'workspace' => $this->getWorkspace()->getGid(),  | 
                                                        
| 194 | 194 | 'resource' => $this->getGid()  | 
                                                        
| 195 | 195 | ]);  | 
                                                        
| 196 | 196 | }  | 
                                                        
| 197 | 197 | |
| 198 | -    public function isBoard (): bool { | 
                                                        |
| 198 | +    public function isBoard(): bool { | 
                                                        |
| 199 | 199 | return $this->getLayout() === self::LAYOUT_BOARD;  | 
                                                        
| 200 | 200 | }  | 
                                                        
| 201 | 201 | |
| 202 | -    public function isList (): bool { | 
                                                        |
| 202 | +    public function isList(): bool { | 
                                                        |
| 203 | 203 | return $this->getLayout() === self::LAYOUT_LIST;  | 
                                                        
| 204 | 204 | }  | 
                                                        
| 205 | 205 | |
@@ -207,7 +207,7 @@ discard block  | 
                                                    ||
| 207 | 207 | * @depends after-create  | 
                                                        
| 208 | 208 | * @return Section  | 
                                                        
| 209 | 209 | */  | 
                                                        
| 210 | -    public function newSection () { | 
                                                        |
| 210 | +    public function newSection() { | 
                                                        |
| 211 | 211 | return $this->factory(Section::class, ['projects' => [$this]]);  | 
                                                        
| 212 | 212 | }  | 
                                                        
| 213 | 213 | |
@@ -215,7 +215,7 @@ discard block  | 
                                                    ||
| 215 | 215 | * @depends after-create  | 
                                                        
| 216 | 216 | * @return Status  | 
                                                        
| 217 | 217 | */  | 
                                                        
| 218 | -    public function newStatus () { | 
                                                        |
| 218 | +    public function newStatus() { | 
                                                        |
| 219 | 219 | return $this->factory(Status::class);  | 
                                                        
| 220 | 220 | }  | 
                                                        
| 221 | 221 | |
@@ -225,7 +225,7 @@ discard block  | 
                                                    ||
| 225 | 225 | * @depends after-create  | 
                                                        
| 226 | 226 | * @return Task  | 
                                                        
| 227 | 227 | */  | 
                                                        
| 228 | -    public function newTask () { | 
                                                        |
| 228 | +    public function newTask() { | 
                                                        |
| 229 | 229 | return $this->getSections()[0]->newTask();  | 
                                                        
| 230 | 230 | }  | 
                                                        
| 231 | 231 | |
@@ -234,7 +234,7 @@ discard block  | 
                                                    ||
| 234 | 234 | * @param User $user  | 
                                                        
| 235 | 235 | * @return $this  | 
                                                        
| 236 | 236 | */  | 
                                                        
| 237 | -    public function removeMember (User $user) { | 
                                                        |
| 237 | +    public function removeMember(User $user) { | 
                                                        |
| 238 | 238 | return $this->removeMembers([$user]);  | 
                                                        
| 239 | 239 | }  | 
                                                        
| 240 | 240 | |
@@ -243,7 +243,7 @@ discard block  | 
                                                    ||
| 243 | 243 | * @param User[] $users  | 
                                                        
| 244 | 244 | * @return $this  | 
                                                        
| 245 | 245 | */  | 
                                                        
| 246 | -    public function removeMembers (array $users) { | 
                                                        |
| 246 | +    public function removeMembers(array $users) { | 
                                                        |
| 247 | 247 |          $this->api->post("{$this}/removeMembers", ['members' => array_column($users, 'gid')]); | 
                                                        
| 248 | 248 |          $this->_remove('members', $users); | 
                                                        
| 249 | 249 | return $this;  | 
                                                        
@@ -254,7 +254,7 @@ discard block  | 
                                                    ||
| 254 | 254 | * @param null|Team $team  | 
                                                        
| 255 | 255 | * @return $this  | 
                                                        
| 256 | 256 | */  | 
                                                        
| 257 | -    public function setTeam (?Team $team) { | 
                                                        |
| 257 | +    public function setTeam(?Team $team) { | 
                                                        |
| 258 | 258 | assert(!$this->hasGid());  | 
                                                        
| 259 | 259 |          if ($team and !$this->hasWorkspace()) { | 
                                                        
| 260 | 260 | $this->setWorkspace($team->getOrganization());  |