@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @return bool |
36 | 36 | * @internal pool |
37 | 37 | */ |
38 | - final public function __merge (self $entity): bool { |
|
38 | + final public function __merge(self $entity): bool { |
|
39 | 39 | $old = $this->toArray(); |
40 | 40 | $this->data = array_merge($this->data, array_diff_key($entity->data, $this->diff)); |
41 | 41 | return $this->toArray() !== $old; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return string |
48 | 48 | */ |
49 | - final public function __toString (): string { |
|
49 | + final public function __toString(): string { |
|
50 | 50 | return static::DIR . '/' . $this->getGid(); |
51 | 51 | } |
52 | 52 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param string $field |
57 | 57 | * @return mixed |
58 | 58 | */ |
59 | - protected function _get (string $field) { |
|
59 | + protected function _get(string $field) { |
|
60 | 60 | if (!array_key_exists($field, $this->data) and $this->hasGid()) { |
61 | 61 | $this->_reload($field); |
62 | 62 | } |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | /** |
67 | 67 | * @param string $field |
68 | 68 | */ |
69 | - protected function _reload (string $field): void { |
|
69 | + protected function _reload(string $field): void { |
|
70 | 70 | $remote = $this->api->get($this, ['opt_fields' => static::OPT_FIELDS[$field] ?? $field]); |
71 | 71 | $this->_setField($field, $remote[$field]); |
72 | 72 | $this->api->getPool()->add($this); |
73 | 73 | } |
74 | 74 | |
75 | - protected function _setData (array $data): void { |
|
75 | + protected function _setData(array $data): void { |
|
76 | 76 | // meaningless once the entity is being created. it's constant. |
77 | 77 | unset($data['resource_type'], $data['type']); |
78 | 78 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | /** |
83 | 83 | * @return null|string |
84 | 84 | */ |
85 | - final public function getGid (): ?string { |
|
85 | + final public function getGid(): ?string { |
|
86 | 86 | return $this->data['gid'] ?? null; |
87 | 87 | } |
88 | 88 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return string[] |
93 | 93 | */ |
94 | - public function getPoolKeys () { |
|
94 | + public function getPoolKeys() { |
|
95 | 95 | return [$this->getGid(), (string)$this]; |
96 | 96 | } |
97 | 97 | |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return string |
102 | 102 | */ |
103 | - final public function getResourceType (): string { |
|
103 | + final public function getResourceType(): string { |
|
104 | 104 | return static::TYPE; |
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
108 | 108 | * @return bool |
109 | 109 | */ |
110 | - final public function hasGid (): bool { |
|
110 | + final public function hasGid(): bool { |
|
111 | 111 | return isset($this->data['gid']); |
112 | 112 | } |
113 | 113 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @depends after-create |
118 | 118 | * @return $this |
119 | 119 | */ |
120 | - public function reload () { |
|
120 | + public function reload() { |
|
121 | 121 | $remote = $this->api->get($this, ['opt_expand' => 'this']); |
122 | 122 | if (!isset($remote['gid'])) { // null and dir guard |
123 | 123 | $this->api->getPool()->remove($this->getPoolKeys()); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * |
24 | 24 | * @return $this |
25 | 25 | */ |
26 | - public function create () { |
|
26 | + public function create() { |
|
27 | 27 | $path = static::DIR; |
28 | 28 | if (isset($this->parent)) { |
29 | 29 | $path = "{$this->parent}/{$path}"; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @param CustomField $customField |
38 | 38 | * @param array $data |
39 | 39 | */ |
40 | - public function __construct (CustomField $customField, array $data = []) { |
|
40 | + public function __construct(CustomField $customField, array $data = []) { |
|
41 | 41 | $this->parent = $customField; |
42 | 42 | parent::__construct($customField, $data); |
43 | 43 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | /** |
46 | 46 | * @return CustomField |
47 | 47 | */ |
48 | - public function getCustomField () { |
|
48 | + public function getCustomField() { |
|
49 | 49 | return $this->parent; |
50 | 50 | } |
51 | 51 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param EnumOption $option |
59 | 59 | * @return $this |
60 | 60 | */ |
61 | - public function moveAbove (EnumOption $option) { |
|
61 | + public function moveAbove(EnumOption $option) { |
|
62 | 62 | $this->api->post("{$this->parent}/enum_options/insert", [ |
63 | 63 | 'before_enum_option' => $option->getGid(), |
64 | 64 | 'enum_option' => $this->getGid() |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param EnumOption $option |
77 | 77 | * @return $this |
78 | 78 | */ |
79 | - public function moveBelow (EnumOption $option) { |
|
79 | + public function moveBelow(EnumOption $option) { |
|
80 | 80 | $this->api->post("{$this->parent}/enum_options//insert", [ |
81 | 81 | 'after_enum_option' => $option->getGid(), |
82 | 82 | 'enum_option' => $this->getGid() |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @depends after-create |
92 | 92 | * @return $this |
93 | 93 | */ |
94 | - public function moveFirst () { |
|
94 | + public function moveFirst() { |
|
95 | 95 | $first = $this->parent->getEnumOptions()[0]; |
96 | 96 | if ($first !== $this) { |
97 | 97 | $this->moveAbove($first); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @depends after-create |
106 | 106 | * @return $this |
107 | 107 | */ |
108 | - public function moveLast () { |
|
108 | + public function moveLast() { |
|
109 | 109 | $options = $this->parent->getEnumOptions(); |
110 | 110 | $last = $options[count($options) - 1]; |
111 | 111 | if ($last !== $this) { |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | 'target' => Task::class |
49 | 49 | ]; |
50 | 50 | |
51 | - public function __construct ($caller, array $data = []) { |
|
51 | + public function __construct($caller, array $data = []) { |
|
52 | 52 | parent::__construct($caller, $data); |
53 | 53 | $this->parent = $this->getTarget(); |
54 | 54 | } |
55 | 55 | |
56 | - protected function _setData (array $data): void { |
|
56 | + protected function _setData(array $data): void { |
|
57 | 57 | // hearts were deprecated for likes |
58 | 58 | unset($data['hearted'], $data['hearts'], $data['num_hearts']); |
59 | 59 | |
@@ -63,49 +63,49 @@ discard block |
||
63 | 63 | /** |
64 | 64 | * @return bool |
65 | 65 | */ |
66 | - final public function isAssignment (): bool { |
|
66 | + final public function isAssignment(): bool { |
|
67 | 67 | return $this->getResourceSubtype() === self::TYPE_ASSIGNED; |
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
71 | 71 | * @return bool |
72 | 72 | */ |
73 | - final public function isComment (): bool { |
|
73 | + final public function isComment(): bool { |
|
74 | 74 | return $this->getResourceSubtype() === self::TYPE_COMMENT_ADDED; |
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
78 | 78 | * @return bool |
79 | 79 | */ |
80 | - final public function isDueDate (): bool { |
|
80 | + final public function isDueDate(): bool { |
|
81 | 81 | return $this->getResourceSubtype() === self::TYPE_DUE_DATE_CHANGED; |
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
85 | 85 | * @return bool |
86 | 86 | */ |
87 | - final public function isEdited (): bool { |
|
87 | + final public function isEdited(): bool { |
|
88 | 88 | return $this->_is('is_edited'); |
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
92 | 92 | * @return bool |
93 | 93 | */ |
94 | - final public function isFromApi (): bool { |
|
94 | + final public function isFromApi(): bool { |
|
95 | 95 | return $this->getSource() === 'api'; |
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
99 | 99 | * @return bool |
100 | 100 | */ |
101 | - final public function isFromWeb (): bool { |
|
101 | + final public function isFromWeb(): bool { |
|
102 | 102 | return $this->getSource() === 'web'; |
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
106 | 106 | * @return bool |
107 | 107 | */ |
108 | - final public function isPinned (): bool { |
|
108 | + final public function isPinned(): bool { |
|
109 | 109 | return $this->_is('is_pinned'); |
110 | 110 | } |
111 | 111 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param bool $pinned |
114 | 114 | * @return $this |
115 | 115 | */ |
116 | - final public function setPinned (bool $pinned) { |
|
116 | + final public function setPinned(bool $pinned) { |
|
117 | 117 | return $this->_set('is_pinned', $pinned); |
118 | 118 | } |
119 | 119 |
@@ -43,7 +43,7 @@ |
||
43 | 43 | * @param string $file |
44 | 44 | * @return $this |
45 | 45 | */ |
46 | - public function create (string $file) { |
|
46 | + public function create(string $file) { |
|
47 | 47 | // api returns compact version. reload. |
48 | 48 | $remote = $this->api->call('POST', "{$this->getParent()}/attachments", [ |
49 | 49 | CURLOPT_POSTFIELDS => ['file' => new CURLFile(realpath($file))] // multipart/form-data |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | 'memberships' => 'memberships.(project|section)' |
117 | 117 | ]; |
118 | 118 | |
119 | - private function _onSave (): void { |
|
119 | + private function _onSave(): void { |
|
120 | 120 | /** @var FieldEntries $fields */ |
121 | 121 | if ($fields = $this->data['custom_fields'] ?? null) { |
122 | 122 | $fields->__unset(true); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | - protected function _setData (array $data): void { |
|
130 | + protected function _setData(array $data): void { |
|
131 | 131 | // hearts were deprecated for likes |
132 | 132 | unset($data['hearted'], $data['hearts'], $data['num_hearts']); |
133 | 133 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @param string $file |
148 | 148 | * @return Attachment |
149 | 149 | */ |
150 | - public function addAttachment (string $file) { |
|
150 | + public function addAttachment(string $file) { |
|
151 | 151 | /** @var Attachment $attachment */ |
152 | 152 | $attachment = $this->api->factory($this, Attachment::class, ['parent' => $this]); |
153 | 153 | return $attachment->create($file); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param string $text |
161 | 161 | * @return Story |
162 | 162 | */ |
163 | - public function addComment (string $text) { |
|
163 | + public function addComment(string $text) { |
|
164 | 164 | return $this->newComment()->setText($text)->create(); |
165 | 165 | } |
166 | 166 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param Task[] $tasks |
172 | 172 | * @return $this |
173 | 173 | */ |
174 | - public function addDependencies (array $tasks) { |
|
174 | + public function addDependencies(array $tasks) { |
|
175 | 175 | $this->api->post("{$this}/addDependencies", ['dependents' => array_column($tasks, 'gid')]); |
176 | 176 | return $this; |
177 | 177 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @param Task $task |
184 | 184 | * @return $this |
185 | 185 | */ |
186 | - public function addDependency (Task $task) { |
|
186 | + public function addDependency(Task $task) { |
|
187 | 187 | return $this->addDependencies([$task]); |
188 | 188 | } |
189 | 189 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * @param Task $task |
195 | 195 | * @return $this |
196 | 196 | */ |
197 | - public function addDependent (Task $task) { |
|
197 | + public function addDependent(Task $task) { |
|
198 | 198 | return $this->addDependents([$task]); |
199 | 199 | } |
200 | 200 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | * @param Task[] $tasks |
206 | 206 | * @return $this |
207 | 207 | */ |
208 | - public function addDependents (array $tasks) { |
|
208 | + public function addDependents(array $tasks) { |
|
209 | 209 | $this->api->post("{$this}/addDependents", ['dependents' => array_column($tasks, 'gid')]); |
210 | 210 | return $this; |
211 | 211 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @param User $user |
217 | 217 | * @return $this |
218 | 218 | */ |
219 | - public function addFollower (User $user) { |
|
219 | + public function addFollower(User $user) { |
|
220 | 220 | return $this->addFollowers([$user]); |
221 | 221 | } |
222 | 222 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * @param User[] $users |
229 | 229 | * @return $this |
230 | 230 | */ |
231 | - public function addFollowers (array $users) { |
|
231 | + public function addFollowers(array $users) { |
|
232 | 232 | return $this->_addWithPost("{$this}/addFollowers", [ |
233 | 233 | 'followers' => array_column($users, 'gid') |
234 | 234 | ], 'followers', $users); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @param Tag $tag |
243 | 243 | * @return $this |
244 | 244 | */ |
245 | - public function addTag (Tag $tag) { |
|
245 | + public function addTag(Tag $tag) { |
|
246 | 246 | return $this->_addWithPost("{$this}/addTag", [ |
247 | 247 | 'tag' => $tag->getGid() |
248 | 248 | ], 'tags', [$tag]); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @param Section $section |
259 | 259 | * @return $this |
260 | 260 | */ |
261 | - public function addToProject (Section $section) { |
|
261 | + public function addToProject(Section $section) { |
|
262 | 262 | /** @var Membership $membership */ |
263 | 263 | $membership = $this->api->factory($this, Membership::class) |
264 | 264 | ->_set('project', $section->getProject()) |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @param string $target |
274 | 274 | * @return TaskWebhook |
275 | 275 | */ |
276 | - public function addWebhook (string $target) { |
|
276 | + public function addWebhook(string $target) { |
|
277 | 277 | /** @var TaskWebhook $webhook */ |
278 | 278 | $webhook = $this->api->factory($this, TaskWebhook::class); |
279 | 279 | $webhook->_set('resource', $this); |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | /** |
285 | 285 | * @return $this |
286 | 286 | */ |
287 | - public function create () { |
|
287 | + public function create() { |
|
288 | 288 | $this->_create(); |
289 | 289 | $this->_onSave(); |
290 | 290 | return $this; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @param string[] $include |
301 | 301 | * @return Job |
302 | 302 | */ |
303 | - public function duplicate (string $name, array $include) { |
|
303 | + public function duplicate(string $name, array $include) { |
|
304 | 304 | /** @var array $remote */ |
305 | 305 | $remote = $this->api->post("{$this}/duplicate", [ |
306 | 306 | 'name' => $name, |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * @depends after-create |
316 | 316 | * @return Attachment[] |
317 | 317 | */ |
318 | - public function getAttachments () { |
|
318 | + public function getAttachments() { |
|
319 | 319 | return $this->api->loadAll($this, Attachment::class, "{$this}/attachments"); |
320 | 320 | } |
321 | 321 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * @depends after-create |
324 | 324 | * @return Story[] |
325 | 325 | */ |
326 | - public function getComments () { |
|
326 | + public function getComments() { |
|
327 | 327 | return $this->selectStories(function(Story $story) { |
328 | 328 | return $story->isComment(); |
329 | 329 | }); |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | * @depends after-create |
336 | 336 | * @return Task[] |
337 | 337 | */ |
338 | - public function getDependencies () { |
|
338 | + public function getDependencies() { |
|
339 | 339 | return $this->api->loadAll($this, self::class, "{$this}/dependencies"); |
340 | 340 | } |
341 | 341 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | * @depends after-create |
346 | 346 | * @return Task[] |
347 | 347 | */ |
348 | - public function getDependents () { |
|
348 | + public function getDependents() { |
|
349 | 349 | return $this->api->loadAll($this, self::class, "{$this}/dependents"); |
350 | 350 | } |
351 | 351 | |
@@ -360,21 +360,21 @@ discard block |
||
360 | 360 | * |
361 | 361 | * @return External |
362 | 362 | */ |
363 | - public function getExternal () { |
|
363 | + public function getExternal() { |
|
364 | 364 | return $this->_get('external') ?? $this->data['external'] = $this->api->factory($this, External::class); |
365 | 365 | } |
366 | 366 | |
367 | 367 | /** |
368 | 368 | * @return Project[] |
369 | 369 | */ |
370 | - public function getProjects () { |
|
370 | + public function getProjects() { |
|
371 | 371 | return array_column($this->getMemberships(), 'project'); |
372 | 372 | } |
373 | 373 | |
374 | 374 | /** |
375 | 375 | * @return Section[] |
376 | 376 | */ |
377 | - public function getSections () { |
|
377 | + public function getSections() { |
|
378 | 378 | return array_column($this->getMemberships(), 'section'); |
379 | 379 | } |
380 | 380 | |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | * @depends after-create |
383 | 383 | * @return Story[] |
384 | 384 | */ |
385 | - public function getStories () { |
|
385 | + public function getStories() { |
|
386 | 386 | return $this->api->loadAll($this, Story::class, "{$this}/stories"); |
387 | 387 | } |
388 | 388 | |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | * @depends after-create |
391 | 391 | * @return Task[] |
392 | 392 | */ |
393 | - public function getSubTasks () { |
|
393 | + public function getSubTasks() { |
|
394 | 394 | return $this->api->loadAll($this, self::class, "{$this}/subtasks"); |
395 | 395 | } |
396 | 396 | |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | * @depends after-create |
399 | 399 | * @return string |
400 | 400 | */ |
401 | - public function getUrl (): string { |
|
401 | + public function getUrl(): string { |
|
402 | 402 | return "https://app.asana.com/0/0/{$this->getGid()}"; |
403 | 403 | } |
404 | 404 | |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | * @depends after-create |
407 | 407 | * @return TaskWebhook[] |
408 | 408 | */ |
409 | - public function getWebhooks () { |
|
409 | + public function getWebhooks() { |
|
410 | 410 | return $this->api->loadAll($this, TaskWebhook::class, 'webhooks', [ |
411 | 411 | 'workspace' => $this->getWorkspace()->getGid(), |
412 | 412 | 'resource' => $this->getGid() |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * @depends after-create |
420 | 420 | * @return Story |
421 | 421 | */ |
422 | - public function newComment () { |
|
422 | + public function newComment() { |
|
423 | 423 | return $this->api->factory($this, Story::class, [ |
424 | 424 | 'resource_subtype' => Story::TYPE_COMMENT_ADDED, |
425 | 425 | 'target' => $this |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | * @depends after-create |
433 | 433 | * @return Task |
434 | 434 | */ |
435 | - public function newSubTask () { |
|
435 | + public function newSubTask() { |
|
436 | 436 | /** @var Task $sub */ |
437 | 437 | $sub = $this->api->factory($this, self::class); |
438 | 438 | return $sub->setParent($this); |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | * @param Task[] $tasks |
446 | 446 | * @return $this |
447 | 447 | */ |
448 | - public function removeDependencies (array $tasks) { |
|
448 | + public function removeDependencies(array $tasks) { |
|
449 | 449 | $this->api->post("{$this}/removeDependencies", ['dependencies' => array_column($tasks, 'gid')]); |
450 | 450 | return $this; |
451 | 451 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | * @param Task $task |
458 | 458 | * @return $this |
459 | 459 | */ |
460 | - public function removeDependency (Task $task) { |
|
460 | + public function removeDependency(Task $task) { |
|
461 | 461 | return $this->removeDependencies([$task]); |
462 | 462 | } |
463 | 463 | |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | * @param Task $task |
469 | 469 | * @return $this |
470 | 470 | */ |
471 | - public function removeDependent (Task $task) { |
|
471 | + public function removeDependent(Task $task) { |
|
472 | 472 | return $this->removeDependents([$task]); |
473 | 473 | } |
474 | 474 | |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * @param Task[] $tasks |
480 | 480 | * @return $this |
481 | 481 | */ |
482 | - public function removeDependents (array $tasks) { |
|
482 | + public function removeDependents(array $tasks) { |
|
483 | 483 | $this->api->post("{$this}/removeDependents", ['dependents' => array_column($tasks, 'gid')]); |
484 | 484 | return $this; |
485 | 485 | } |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | * @param User $user |
491 | 491 | * @return $this |
492 | 492 | */ |
493 | - public function removeFollower (User $user) { |
|
493 | + public function removeFollower(User $user) { |
|
494 | 494 | return $this->removeFollowers([$user]); |
495 | 495 | } |
496 | 496 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | * @param User[] $users |
503 | 503 | * @return $this |
504 | 504 | */ |
505 | - public function removeFollowers (array $users) { |
|
505 | + public function removeFollowers(array $users) { |
|
506 | 506 | return $this->_removeWithPost("{$this}/removeFollowers", [ |
507 | 507 | 'followers' => array_column($users, 'gid') |
508 | 508 | ], 'followers', $users); |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | * @param Project $project |
517 | 517 | * @return $this |
518 | 518 | */ |
519 | - public function removeFromProject (Project $project) { |
|
519 | + public function removeFromProject(Project $project) { |
|
520 | 520 | return $this->_removeWithPost("{$this}/removeProject", [ |
521 | 521 | 'project' => $project->getGid() |
522 | 522 | ], 'memberships', function(Membership $membership) use ($project) { |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | * @param Tag $tag |
533 | 533 | * @return $this |
534 | 534 | */ |
535 | - public function removeTag (Tag $tag) { |
|
535 | + public function removeTag(Tag $tag) { |
|
536 | 536 | return $this->_removeWithPost("{$this}/removeTag", [ |
537 | 537 | 'tag' => $tag->getGid() |
538 | 538 | ], 'tags', [$tag]); |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | * @param null|Task $parent |
546 | 546 | * @return $this |
547 | 547 | */ |
548 | - public function setParent (?self $parent) { |
|
548 | + public function setParent(?self $parent) { |
|
549 | 549 | return $this->_setWithPost("{$this}/setParent", [ |
550 | 550 | 'parent' => $parent |
551 | 551 | ], 'parent', $parent); |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | /** |
555 | 555 | * @return $this |
556 | 556 | */ |
557 | - public function update () { |
|
557 | + public function update() { |
|
558 | 558 | $this->_update(); |
559 | 559 | $this->_onSave(); |
560 | 560 | return $this; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @param Workspace $workspace |
38 | 38 | * @return $this |
39 | 39 | */ |
40 | - public function addToWorkspace (Workspace $workspace) { |
|
40 | + public function addToWorkspace(Workspace $workspace) { |
|
41 | 41 | return $this->_addWithPost("{$workspace}/addUser", [ |
42 | 42 | 'user' => $this->getGid() |
43 | 43 | ], 'workspaces', [$workspace]); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return Workspace |
50 | 50 | */ |
51 | - public function getDefaultWorkspace () { |
|
51 | + public function getDefaultWorkspace() { |
|
52 | 52 | return $this->getWorkspaces()[0]; |
53 | 53 | } |
54 | 54 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param null|Workspace $workspace Falls back to the default workspace. |
57 | 57 | * @return Portfolio[] |
58 | 58 | */ |
59 | - public function getFavoritePortfolios (Workspace $workspace = null) { |
|
59 | + public function getFavoritePortfolios(Workspace $workspace = null) { |
|
60 | 60 | return $this->getFavorites(Portfolio::class, Portfolio::TYPE, $workspace); |
61 | 61 | } |
62 | 62 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param null|Workspace $workspace Falls back to the default workspace. |
65 | 65 | * @return Project[] |
66 | 66 | */ |
67 | - public function getFavoriteProjects (Workspace $workspace = null) { |
|
67 | + public function getFavoriteProjects(Workspace $workspace = null) { |
|
68 | 68 | return $this->getFavorites(Project::class, Project::TYPE, $workspace); |
69 | 69 | } |
70 | 70 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param null|Workspace $workspace Falls back to the default workspace. |
73 | 73 | * @return Tag[] |
74 | 74 | */ |
75 | - public function getFavoriteTags (Workspace $workspace = null) { |
|
75 | + public function getFavoriteTags(Workspace $workspace = null) { |
|
76 | 76 | return $this->getFavorites(Tag::class, Tag::TYPE, $workspace); |
77 | 77 | } |
78 | 78 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @param null|Workspace $workspace Falls back to the default workspace. |
81 | 81 | * @return Team[] |
82 | 82 | */ |
83 | - public function getFavoriteTeams (Workspace $workspace = null) { |
|
83 | + public function getFavoriteTeams(Workspace $workspace = null) { |
|
84 | 84 | return $this->getFavorites(Team::class, Team::TYPE, $workspace); |
85 | 85 | } |
86 | 86 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @param null|Workspace $workspace Falls back to the default workspace. |
89 | 89 | * @return User[] |
90 | 90 | */ |
91 | - public function getFavoriteUsers (Workspace $workspace = null) { |
|
91 | + public function getFavoriteUsers(Workspace $workspace = null) { |
|
92 | 92 | return $this->getFavorites(self::class, self::TYPE, $workspace); |
93 | 93 | } |
94 | 94 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param null|Workspace $workspace Falls back to the default workspace. |
99 | 99 | * @return array |
100 | 100 | */ |
101 | - protected function getFavorites (string $class, string $resourceType, Workspace $workspace = null) { |
|
101 | + protected function getFavorites(string $class, string $resourceType, Workspace $workspace = null) { |
|
102 | 102 | return $this->api->loadAll($this, $class, "{$this}/favorites", [ |
103 | 103 | 'resource_type' => $resourceType, |
104 | 104 | 'workspace' => ($workspace ?? $this->api->getDefaultWorkspace())->getGid() |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | /** |
109 | 109 | * @return string[] |
110 | 110 | */ |
111 | - public function getPoolKeys () { |
|
111 | + public function getPoolKeys() { |
|
112 | 112 | $keys = parent::getPoolKeys(); |
113 | 113 | |
114 | 114 | // include email as a key if it's loaded |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param null|Workspace $workspace |
124 | 124 | * @return Portfolio[] |
125 | 125 | */ |
126 | - public function getPortfolios (Workspace $workspace = null) { |
|
126 | + public function getPortfolios(Workspace $workspace = null) { |
|
127 | 127 | return $this->api->loadAll($this, Portfolio::class, "portfolios", [ |
128 | 128 | 'workspace' => ($workspace ?? $this->api->getDefaultWorkspace())->getGid(), |
129 | 129 | 'owner' => $this->getGid() |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param null|Workspace $workspace Falls back to the default workspace. |
135 | 135 | * @return TaskList |
136 | 136 | */ |
137 | - public function getTaskList (Workspace $workspace = null) { |
|
137 | + public function getTaskList(Workspace $workspace = null) { |
|
138 | 138 | return $this->api->load($this, TaskList::class, "{$this}/user_task_list", [ |
139 | 139 | 'workspace' => ($workspace ?? $this->api->getDefaultWorkspace())->getGid() |
140 | 140 | ]); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param string[] $filter `workspace` falls back to the default. |
147 | 147 | * @return Task[] |
148 | 148 | */ |
149 | - public function getTasks (array $filter = Task::GET_INCOMPLETE) { |
|
149 | + public function getTasks(array $filter = Task::GET_INCOMPLETE) { |
|
150 | 150 | $filter['assignee'] = $this->getGid(); |
151 | 151 | $filter += ['workspace' => $this->api->getDefaultWorkspace()->getGid()]; |
152 | 152 | return $this->api->loadAll($this, Task::class, 'tasks', $filter); |
@@ -160,13 +160,13 @@ discard block |
||
160 | 160 | * @param null|Workspace $organization Falls back to the default workspace. |
161 | 161 | * @return Team[] |
162 | 162 | */ |
163 | - public function getTeams (Workspace $organization = null) { |
|
163 | + public function getTeams(Workspace $organization = null) { |
|
164 | 164 | return $this->api->loadAll($this, Team::class, "{$this}/teams", [ |
165 | 165 | 'organization' => ($organization ?? $this->getDefaultWorkspace())->getGid() |
166 | 166 | ]); |
167 | 167 | } |
168 | 168 | |
169 | - public function getUrl (): string { |
|
169 | + public function getUrl(): string { |
|
170 | 170 | return "https://app.asana.com/0/{$this->getGid()}/list"; |
171 | 171 | } |
172 | 172 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param Workspace $workspace |
175 | 175 | * @return $this |
176 | 176 | */ |
177 | - public function removeFromWorkspace (Workspace $workspace) { |
|
177 | + public function removeFromWorkspace(Workspace $workspace) { |
|
178 | 178 | return $this->_removeWithPost("{$workspace}/removeUser", [ |
179 | 179 | 'user' => $this->getGid() |
180 | 180 | ], 'workspaces', [$workspace]); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | private $defaultSection; |
92 | 92 | |
93 | - protected function _setData (array $data): void { |
|
93 | + protected function _setData(array $data): void { |
|
94 | 94 | // this is always empty. fields are in the settings, values are in tasks. |
95 | 95 | unset($data['custom_fields']); |
96 | 96 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @param User $user |
106 | 106 | * @return $this |
107 | 107 | */ |
108 | - public function addMember (User $user) { |
|
108 | + public function addMember(User $user) { |
|
109 | 109 | return $this->addMembers([$user]); |
110 | 110 | } |
111 | 111 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @param User[] $users |
115 | 115 | * @return $this |
116 | 116 | */ |
117 | - public function addMembers (array $users) { |
|
117 | + public function addMembers(array $users) { |
|
118 | 118 | return $this->_addWithPost("{$this}/addMembers", [ |
119 | 119 | 'members' => array_column($users, 'gid') |
120 | 120 | ], 'members', $users); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @param string $target |
126 | 126 | * @return ProjectWebhook |
127 | 127 | */ |
128 | - public function addWebhook (string $target) { |
|
128 | + public function addWebhook(string $target) { |
|
129 | 129 | /** @var ProjectWebhook $webhook */ |
130 | 130 | $webhook = $this->api->factory($this, ProjectWebhook::class); |
131 | 131 | $webhook->_set('resource', $this); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @param array $schedule |
153 | 153 | * @return Job |
154 | 154 | */ |
155 | - public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) { |
|
155 | + public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) { |
|
156 | 156 | $data = ['name' => $name]; |
157 | 157 | if ($team) { |
158 | 158 | $data['team'] = $team->getGid(); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @depends after-create |
173 | 173 | * @return Section |
174 | 174 | */ |
175 | - public function getDefaultSection () { |
|
175 | + public function getDefaultSection() { |
|
176 | 176 | return $this->defaultSection ?? $this->defaultSection = $this->getSections(1)[0]; |
177 | 177 | } |
178 | 178 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * @param int $limit |
185 | 185 | * @return Traversable|Section[] |
186 | 186 | */ |
187 | - public function getIterator (int $limit = PHP_INT_MAX) { |
|
187 | + public function getIterator(int $limit = PHP_INT_MAX) { |
|
188 | 188 | return $this->api->loadEach($this, Section::class, "{$this}/sections", ['limit' => $limit]); |
189 | 189 | } |
190 | 190 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * @param int $limit |
194 | 194 | * @return Section[] |
195 | 195 | */ |
196 | - public function getSections (int $limit = PHP_INT_MAX) { |
|
196 | + public function getSections(int $limit = PHP_INT_MAX) { |
|
197 | 197 | return iterator_to_array($this->getIterator($limit)); |
198 | 198 | } |
199 | 199 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @depends after-create |
202 | 202 | * @return Status[] |
203 | 203 | */ |
204 | - public function getStatuses () { |
|
204 | + public function getStatuses() { |
|
205 | 205 | return $this->api->loadAll($this, Status::class, "{$this}/project_statuses"); |
206 | 206 | } |
207 | 207 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @depends after-create |
210 | 210 | * @return TaskCounts |
211 | 211 | */ |
212 | - public function getTaskCounts () { |
|
212 | + public function getTaskCounts() { |
|
213 | 213 | $remote = $this->api->get("{$this}/task_counts", [ |
214 | 214 | 'opt_fields' => // opt_expand doesn't work. |
215 | 215 | 'num_completed_milestones,' |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * @param array $filter |
230 | 230 | * @return Task[] |
231 | 231 | */ |
232 | - public function getTasks (array $filter = Task::GET_INCOMPLETE) { |
|
232 | + public function getTasks(array $filter = Task::GET_INCOMPLETE) { |
|
233 | 233 | $filter['project'] = $this->getGid(); |
234 | 234 | return $this->api->loadAll($this, Task::class, "tasks", $filter); |
235 | 235 | } |
@@ -238,14 +238,14 @@ discard block |
||
238 | 238 | * @depends after-create |
239 | 239 | * @return string |
240 | 240 | */ |
241 | - public function getUrl (): string { |
|
241 | + public function getUrl(): string { |
|
242 | 242 | return "https://app.asana.com/0/{$this->getGid()}"; |
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
246 | 246 | * @return ProjectWebhook[] |
247 | 247 | */ |
248 | - public function getWebhooks () { |
|
248 | + public function getWebhooks() { |
|
249 | 249 | return $this->api->loadAll($this, ProjectWebhook::class, 'webhooks', [ |
250 | 250 | 'workspace' => $this->getWorkspace()->getGid(), |
251 | 251 | 'resource' => $this->getGid() |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | /** |
256 | 256 | * @return bool |
257 | 257 | */ |
258 | - final public function isBoard (): bool { |
|
258 | + final public function isBoard(): bool { |
|
259 | 259 | return $this->getLayout() === self::LAYOUT_BOARD; |
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
263 | 263 | * @return bool |
264 | 264 | */ |
265 | - final public function isList (): bool { |
|
265 | + final public function isList(): bool { |
|
266 | 266 | return $this->getLayout() === self::LAYOUT_LIST; |
267 | 267 | } |
268 | 268 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @depends after-create |
273 | 273 | * @return Section |
274 | 274 | */ |
275 | - public function newSection () { |
|
275 | + public function newSection() { |
|
276 | 276 | return $this->api->factory($this, Section::class, ['project' => $this]); |
277 | 277 | } |
278 | 278 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * @depends after-create |
283 | 283 | * @return Status |
284 | 284 | */ |
285 | - public function newStatus () { |
|
285 | + public function newStatus() { |
|
286 | 286 | return $this->api->factory($this, Status::class); |
287 | 287 | } |
288 | 288 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * @depends after-create |
293 | 293 | * @return Task |
294 | 294 | */ |
295 | - public function newTask () { |
|
295 | + public function newTask() { |
|
296 | 296 | return $this->getDefaultSection()->newTask(); |
297 | 297 | } |
298 | 298 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * @param User $user |
302 | 302 | * @return $this |
303 | 303 | */ |
304 | - public function removeMember (User $user) { |
|
304 | + public function removeMember(User $user) { |
|
305 | 305 | return $this->removeMembers([$user]); |
306 | 306 | } |
307 | 307 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * @param User[] $users |
311 | 311 | * @return $this |
312 | 312 | */ |
313 | - public function removeMembers (array $users) { |
|
313 | + public function removeMembers(array $users) { |
|
314 | 314 | return $this->_removeWithPost("{$this}/removeMembers", [ |
315 | 315 | 'members' => array_column($users, 'gid') |
316 | 316 | ], 'members', $users); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * @param null|Team $team |
322 | 322 | * @return $this |
323 | 323 | */ |
324 | - public function setTeam (?Team $team) { |
|
324 | + public function setTeam(?Team $team) { |
|
325 | 325 | if ($team and !$this->hasWorkspace()) { |
326 | 326 | $this->setWorkspace($team->getOrganization()); |
327 | 327 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param User $user |
31 | 31 | * @return $this |
32 | 32 | */ |
33 | - public function addUser (User $user) { |
|
33 | + public function addUser(User $user) { |
|
34 | 34 | $this->api->post("{$this}/addUser", ['user' => $user->getGid()]); |
35 | 35 | return $this; |
36 | 36 | } |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | * @param array $filter |
44 | 44 | * @return Project[] |
45 | 45 | */ |
46 | - public function getProjects (array $filter = Project::GET_ACTIVE) { |
|
46 | + public function getProjects(array $filter = Project::GET_ACTIVE) { |
|
47 | 47 | return $this->api->loadAll($this, Project::class, "{$this}/projects", $filter); |
48 | 48 | } |
49 | 49 | |
50 | - public function getUrl (): string { |
|
50 | + public function getUrl(): string { |
|
51 | 51 | return "https://app.asana.com/0/{$this->getGid()}/overview"; |
52 | 52 | } |
53 | 53 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @return User[] |
60 | 60 | */ |
61 | - public function getUsers () { |
|
61 | + public function getUsers() { |
|
62 | 62 | return $this->api->loadAll($this, User::class, "{$this}/users"); |
63 | 63 | } |
64 | 64 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @param User $user |
67 | 67 | * @return $this |
68 | 68 | */ |
69 | - public function removeUser (User $user) { |
|
69 | + public function removeUser(User $user) { |
|
70 | 70 | $this->api->post("{$this}/removeUser", ['user' => $user->getGid()]); |
71 | 71 | return $this; |
72 | 72 | } |