@@ -121,7 +121,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | return $this->_setWithPost("{$this}/setParent", [ |
525 | 525 | 'parent' => $parent |
526 | 526 | ], 'parent', $parent); |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | /** |
530 | 530 | * @return $this |
531 | 531 | */ |
532 | - public function update () { |
|
532 | + public function update() { |
|
533 | 533 | $this->_update(); |
534 | 534 | $this->_onSave(); |
535 | 535 | return $this; |