@@ -16,7 +16,7 @@ |
||
16 | 16 | 'user' => User::class |
17 | 17 | ]; |
18 | 18 | |
19 | - protected function _setData (array $data): void { |
|
19 | + protected function _setData(array $data): void { |
|
20 | 20 | unset($data['gid']); // useless, likes aren't entities. |
21 | 21 | parent::_setData($data); |
22 | 22 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | 'parent' => Task::class |
33 | 33 | ]; |
34 | 34 | |
35 | - final public function __toString (): string { |
|
35 | + final public function __toString(): string { |
|
36 | 36 | return "attachments/{$this->getGid()}"; |
37 | 37 | } |
38 | 38 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param string $file |
45 | 45 | * @return $this |
46 | 46 | */ |
47 | - public function upload (string $file) { |
|
47 | + public function upload(string $file) { |
|
48 | 48 | // api returns compact version. reload. |
49 | 49 | /** @var array $remote */ |
50 | 50 | $remote = $this->api->upload("{$this->getParent()}/attachments", $file); |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | 'enum_options' => [EnumOption::class], |
41 | 41 | ]; |
42 | 42 | |
43 | - final public function __toString (): string { |
|
43 | + final public function __toString(): string { |
|
44 | 44 | return "custom_fields/{$this->getGid()}"; |
45 | 45 | } |
46 | 46 | |
47 | - final protected function _getDir (): string { |
|
47 | + final protected function _getDir(): string { |
|
48 | 48 | return 'custom_fields'; |
49 | 49 | } |
50 | 50 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param string $name |
57 | 57 | * @return EnumOption |
58 | 58 | */ |
59 | - public function addEnumOption (string $name) { |
|
59 | + public function addEnumOption(string $name) { |
|
60 | 60 | /** @var EnumOption $option */ |
61 | 61 | $option = $this->factory(EnumOption::class); |
62 | 62 | $option->setName($name); |
@@ -72,35 +72,35 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * @return bool |
74 | 74 | */ |
75 | - public function hasNotificationsEnabled (): bool { |
|
75 | + public function hasNotificationsEnabled(): bool { |
|
76 | 76 | return $this->_is('has_notifications_enabled'); |
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
80 | 80 | * @return bool |
81 | 81 | */ |
82 | - public function isEnum (): bool { |
|
82 | + public function isEnum(): bool { |
|
83 | 83 | return $this->getResourceSubtype() === self::TYPE_ENUM; |
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
87 | 87 | * @return bool |
88 | 88 | */ |
89 | - public function isGlobalToWorkspace (): bool { |
|
89 | + public function isGlobalToWorkspace(): bool { |
|
90 | 90 | return $this->_is('is_global_to_workspace'); |
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
94 | 94 | * @return bool |
95 | 95 | */ |
96 | - final public function isNumber (): bool { |
|
96 | + final public function isNumber(): bool { |
|
97 | 97 | return $this->getResourceSubtype() === self::TYPE_NUMBER; |
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
101 | 101 | * @return bool |
102 | 102 | */ |
103 | - final public function isText (): bool { |
|
103 | + final public function isText(): bool { |
|
104 | 104 | return $this->getResourceSubtype() === self::TYPE_TEXT; |
105 | 105 | } |
106 | 106 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param bool $flag |
109 | 109 | * @return $this |
110 | 110 | */ |
111 | - public function setGlobalToWorkspace (bool $flag) { |
|
111 | + public function setGlobalToWorkspace(bool $flag) { |
|
112 | 112 | return $this->_set('is_global_to_workspace', $flag); |
113 | 113 | } |
114 | 114 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param bool $flag |
117 | 117 | * @return $this |
118 | 118 | */ |
119 | - public function setNotificationsEnabled (bool $flag) { |
|
119 | + public function setNotificationsEnabled(bool $flag) { |
|
120 | 120 | return $this->_set('has_notifications_enabled', $flag); |
121 | 121 | } |
122 | 122 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param callable $cmp `fn( EnumOption $a, EnumOption $b ): int` |
125 | 125 | * @return $this |
126 | 126 | */ |
127 | - public function sortEnumOptions (callable $cmp) { |
|
127 | + public function sortEnumOptions(callable $cmp) { |
|
128 | 128 | if ($options = $this->getEnumOptions()) { |
129 | 129 | $prev = $options[0]; // first option on remote |
130 | 130 | usort($options, $cmp); |
@@ -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 | return $this->_addWithPost("{$this}/addMembers", [ |
74 | 74 | 'members' => array_column($users, 'gid') |
75 | 75 | ], 'members', $users); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @depends after-create |
80 | 80 | * @return Project[] |
81 | 81 | */ |
82 | - public function getItems () { |
|
82 | + public function getItems() { |
|
83 | 83 | return $this->loadAll(Project::class, "{$this}/items"); |
84 | 84 | } |
85 | 85 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @param Project $item |
89 | 89 | * @return $this |
90 | 90 | */ |
91 | - public function removeItem (Project $item) { |
|
91 | + public function removeItem(Project $item) { |
|
92 | 92 | $this->api->post("{$this}/removeItem", ['item' => $item->getGid()]); |
93 | 93 | return $this; |
94 | 94 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param User $user |
98 | 98 | * @return $this |
99 | 99 | */ |
100 | - public function removeMember (User $user) { |
|
100 | + public function removeMember(User $user) { |
|
101 | 101 | return $this->removeMembers([$user]); |
102 | 102 | } |
103 | 103 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @param User[] $users |
106 | 106 | * @return $this |
107 | 107 | */ |
108 | - public function removeMembers (array $users) { |
|
108 | + public function removeMembers(array $users) { |
|
109 | 109 | return $this->_removeWithPost("{$this}/removeMembers", [ |
110 | 110 | 'members' => array_column($users, 'gid') |
111 | 111 | ], 'members', $users); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | 'organization' => Workspace::class |
26 | 26 | ]; |
27 | 27 | |
28 | - final public function __toString (): string { |
|
28 | + final public function __toString(): string { |
|
29 | 29 | return "teams/{$this->getGid()}"; |
30 | 30 | } |
31 | 31 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param User $user |
34 | 34 | * @return $this |
35 | 35 | */ |
36 | - public function addUser (User $user) { |
|
36 | + public function addUser(User $user) { |
|
37 | 37 | $this->api->post("{$this}/addUser", ['user' => $user->getGid()]); |
38 | 38 | return $this; |
39 | 39 | } |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | * @param array $filter |
47 | 47 | * @return Project[] |
48 | 48 | */ |
49 | - public function getProjects (array $filter = ['archived' => false]) { |
|
49 | + public function getProjects(array $filter = ['archived' => false]) { |
|
50 | 50 | return $this->loadAll(Project::class, "{$this}/projects", $filter); |
51 | 51 | } |
52 | 52 | |
53 | - public function getUrl (): string { |
|
53 | + public function getUrl(): string { |
|
54 | 54 | return "https://app.asana.com/0/{$this->getGid()}/overview"; |
55 | 55 | } |
56 | 56 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return User[] |
63 | 63 | */ |
64 | - public function getUsers () { |
|
64 | + public function getUsers() { |
|
65 | 65 | return $this->loadAll(User::class, "{$this}/users"); |
66 | 66 | } |
67 | 67 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param User $user |
70 | 70 | * @return $this |
71 | 71 | */ |
72 | - public function removeUser (User $user) { |
|
72 | + public function removeUser(User $user) { |
|
73 | 73 | $this->api->post("{$this}/removeUser", ['user' => $user->getGid()]); |
74 | 74 | return $this; |
75 | 75 | } |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | 'project' => Project::class |
29 | 29 | ]; |
30 | 30 | |
31 | - final public function __toString (): string { |
|
31 | + final public function __toString(): string { |
|
32 | 32 | return "sections/{$this->getGid()}"; |
33 | 33 | } |
34 | 34 | |
35 | - final protected function _getDir (): string { |
|
35 | + final protected function _getDir(): string { |
|
36 | 36 | return "{$this->getProject()}/sections"; |
37 | 37 | } |
38 | 38 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @return Task[] |
45 | 45 | */ |
46 | - public function getTasks () { |
|
46 | + public function getTasks() { |
|
47 | 47 | return $this->loadAll(Task::class, 'tasks', ['section' => $this->getGid()]); |
48 | 48 | } |
49 | 49 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @depends after-create |
54 | 54 | * @return Task |
55 | 55 | */ |
56 | - public function newTask () { |
|
56 | + public function newTask() { |
|
57 | 57 | /** @var Task $task */ |
58 | 58 | $task = $this->factory(Task::class); |
59 | 59 | return $task->addToProject($this->getProject(), $this); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param AbstractEntity $entity |
35 | 35 | * @return bool Success |
36 | 36 | */ |
37 | - public function add (AbstractEntity $entity): bool { |
|
37 | + public function add(AbstractEntity $entity): bool { |
|
38 | 38 | if ($gid = $entity->getGid() and !$entity->isDiff()) { |
39 | 39 | $this->entities[$gid] = $entity; |
40 | 40 | $this->addKeys($gid, $entity->getCacheKeys()); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param string $gid |
50 | 50 | * @param string[] $keys |
51 | 51 | */ |
52 | - protected function addKeys (string $gid, array $keys): void { |
|
52 | + protected function addKeys(string $gid, array $keys): void { |
|
53 | 53 | $this->gids += array_fill_keys($keys, $gid); |
54 | 54 | } |
55 | 55 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param Closure $factory `fn( Api|Data $caller ): null|AbstractEntity` |
65 | 65 | * @return null|mixed|AbstractEntity |
66 | 66 | */ |
67 | - public function get (string $key, $caller, Closure $factory) { |
|
67 | + public function get(string $key, $caller, Closure $factory) { |
|
68 | 68 | // POOL HIT |
69 | 69 | if ($gid = $this->gids[$key] ?? null) { |
70 | 70 | return $this->entities[$gid]; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @param AbstractEntity $entity |
94 | 94 | */ |
95 | - public function remove (AbstractEntity $entity): void { |
|
95 | + public function remove(AbstractEntity $entity): void { |
|
96 | 96 | $gid = $entity->getGid(); |
97 | 97 | unset($this->entities[$gid]); |
98 | 98 | foreach ($entity->getCacheKeys() as $key) { |
@@ -12,5 +12,5 @@ |
||
12 | 12 | * @param string $path |
13 | 13 | * @param null|array $data |
14 | 14 | */ |
15 | - public function log (string $message, string $path, array $data = null): void; |
|
15 | + public function log(string $message, string $path, array $data = null): void; |
|
16 | 16 | } |
17 | 17 | \ No newline at end of file |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | 'new_task' => Task::class |
34 | 34 | ]; |
35 | 35 | |
36 | - final public function __toString (): string { |
|
36 | + final public function __toString(): string { |
|
37 | 37 | return "jobs/{$this->getGid()}"; |
38 | 38 | } |
39 | 39 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return bool |
44 | 44 | */ |
45 | - public function isActive (): bool { |
|
45 | + public function isActive(): bool { |
|
46 | 46 | return $this->getStatus() === self::STATUS_ACTIVE; |
47 | 47 | } |
48 | 48 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @return bool |
53 | 53 | */ |
54 | - public function isDone (): bool { |
|
54 | + public function isDone(): bool { |
|
55 | 55 | return $this->isSuccessful() or $this->isFailed(); |
56 | 56 | } |
57 | 57 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return bool |
62 | 62 | */ |
63 | - public function isFailed (): bool { |
|
63 | + public function isFailed(): bool { |
|
64 | 64 | return $this->getStatus() === self::STATUS_FAIL; |
65 | 65 | } |
66 | 66 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return bool |
71 | 71 | */ |
72 | - public function isQueued (): bool { |
|
72 | + public function isQueued(): bool { |
|
73 | 73 | return $this->getStatus() === self::STATUS_QUEUED; |
74 | 74 | } |
75 | 75 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return bool |
80 | 80 | */ |
81 | - public function isSuccessful (): bool { |
|
81 | + public function isSuccessful(): bool { |
|
82 | 82 | return $this->getStatus() === self::STATUS_SUCCESS; |
83 | 83 | } |
84 | 84 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param callable $spinner `fn( Job $this ): void` |
91 | 91 | * @return $this |
92 | 92 | */ |
93 | - public function wait (callable $spinner = null) { |
|
93 | + public function wait(callable $spinner = null) { |
|
94 | 94 | while (!$this->isDone()) { |
95 | 95 | if ($spinner) { |
96 | 96 | call_user_func($spinner, $this); |