@@ -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); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | protected $task; |
26 | 26 | |
27 | - public function __construct (Task $task, array $data = []) { |
|
27 | + public function __construct(Task $task, array $data = []) { |
|
28 | 28 | parent::__construct($task, $data); |
29 | 29 | $this->task = $task; |
30 | 30 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param mixed $value |
37 | 37 | * @return $this |
38 | 38 | */ |
39 | - protected function _set (string $field, $value) { |
|
39 | + protected function _set(string $field, $value) { |
|
40 | 40 | $this->task->diff['external'] = true; |
41 | 41 | return parent::_set($field, $value); |
42 | 42 | } |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | 'workspace' => Workspace::class |
31 | 31 | ]; |
32 | 32 | |
33 | - final public function __toString (): string { |
|
33 | + final public function __toString(): string { |
|
34 | 34 | return "user_task_lists/{$this->getGid()}"; |
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
38 | 38 | * @return Task[] |
39 | 39 | */ |
40 | - public function getIncompleteTasks () { |
|
40 | + public function getIncompleteTasks() { |
|
41 | 41 | return $this->getTasks(['completed_since' => 'now']); |
42 | 42 | } |
43 | 43 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return ArrayIterator|Task[] |
48 | 48 | */ |
49 | - public function getIterator () { |
|
49 | + public function getIterator() { |
|
50 | 50 | return new ArrayIterator($this->getTasks()); |
51 | 51 | } |
52 | 52 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param array $filter |
59 | 59 | * @return Task[] |
60 | 60 | */ |
61 | - public function getTasks (array $filter = []) { |
|
61 | + public function getTasks(array $filter = []) { |
|
62 | 62 | return $this->loadAll(Task::class, "{$this}/tasks", $filter); |
63 | 63 | } |
64 | 64 | } |
65 | 65 | \ No newline at end of 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); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | const TYPE = 'workspace'; |
28 | 28 | |
29 | - final public function __toString (): string { |
|
29 | + final public function __toString(): string { |
|
30 | 30 | return "workspaces/{$this->getGid()}"; |
31 | 31 | } |
32 | 32 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return OrganizationExport |
37 | 37 | */ |
38 | - public function export () { |
|
38 | + public function export() { |
|
39 | 39 | /** @var OrganizationExport $export */ |
40 | 40 | $export = $this->factory(OrganizationExport::class); |
41 | 41 | return $export->create($this); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param int $limit 1-100 |
53 | 53 | * @return array|AbstractEntity[] |
54 | 54 | */ |
55 | - protected function find (string $class, string $resourceType, string $text, int $limit = 20) { |
|
55 | + protected function find(string $class, string $resourceType, string $text, int $limit = 20) { |
|
56 | 56 | return $this->loadAll($class, "{$this}/typeahead", [ |
57 | 57 | 'resource_type' => $resourceType, |
58 | 58 | 'query' => $text, |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @param int $limit 1-100 |
68 | 68 | * @return CustomField[] |
69 | 69 | */ |
70 | - public function findCustomFields (string $text, int $limit = 20) { |
|
70 | + public function findCustomFields(string $text, int $limit = 20) { |
|
71 | 71 | return $this->find(CustomField::class, CustomField::TYPE, $text, $limit); |
72 | 72 | } |
73 | 73 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param int $limit 1-100 |
79 | 79 | * @return Portfolio[] |
80 | 80 | */ |
81 | - public function findPortfolios (string $text, int $limit = 20) { |
|
81 | + public function findPortfolios(string $text, int $limit = 20) { |
|
82 | 82 | return $this->find(Portfolio::class, Portfolio::TYPE, $text, $limit); |
83 | 83 | } |
84 | 84 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @param int $limit 1-100 |
90 | 90 | * @return Project[] |
91 | 91 | */ |
92 | - public function findProjects (string $text, int $limit = 20) { |
|
92 | + public function findProjects(string $text, int $limit = 20) { |
|
93 | 93 | return $this->find(Project::class, Project::TYPE, $text, $limit); |
94 | 94 | } |
95 | 95 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @param int $limit 1-100 |
101 | 101 | * @return Tag[] |
102 | 102 | */ |
103 | - public function findTags (string $text, int $limit = 20) { |
|
103 | + public function findTags(string $text, int $limit = 20) { |
|
104 | 104 | return $this->find(Tag::class, Tag::TYPE, $text, $limit); |
105 | 105 | } |
106 | 106 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @param int $limit 1-100 |
112 | 112 | * @return Task[] |
113 | 113 | */ |
114 | - public function findTasks (string $text, int $limit = 20) { |
|
114 | + public function findTasks(string $text, int $limit = 20) { |
|
115 | 115 | return $this->find(Task::class, Task::TYPE, $text, $limit); |
116 | 116 | } |
117 | 117 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @param int $limit 1-100 |
123 | 123 | * @return User[] |
124 | 124 | */ |
125 | - public function findUsers (string $text, int $limit = 20) { |
|
125 | + public function findUsers(string $text, int $limit = 20) { |
|
126 | 126 | return $this->find(User::class, User::TYPE, $text, $limit); |
127 | 127 | } |
128 | 128 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param array $filter |
135 | 135 | * @return Project[] |
136 | 136 | */ |
137 | - public function getProjects (array $filter = ['archived' => false]) { |
|
137 | + public function getProjects(array $filter = ['archived' => false]) { |
|
138 | 138 | $filter['workspace'] = $this->getGid(); |
139 | 139 | return $this->loadAll(Project::class, 'projects', $filter); |
140 | 140 | } |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | /** |
143 | 143 | * @return Tag[] |
144 | 144 | */ |
145 | - public function getTags () { |
|
145 | + public function getTags() { |
|
146 | 146 | return $this->loadAll(Tag::class, 'tags', ['workspace' => $this->getGid()]); |
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
150 | 150 | * @return Team[] |
151 | 151 | */ |
152 | - public function getTeams () { |
|
152 | + public function getTeams() { |
|
153 | 153 | return $this->loadAll(Team::class, "organizations/{$this->getGid()}/teams"); |
154 | 154 | } |
155 | 155 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param string $email |
158 | 158 | * @return null|User |
159 | 159 | */ |
160 | - public function getUserByEmail (string $email) { |
|
160 | + public function getUserByEmail(string $email) { |
|
161 | 161 | return $this->api->getCache()->get($email, $this, function() use ($email) { |
162 | 162 | foreach ($this->getUsers() as $user) { |
163 | 163 | if ($user->getEmail() === $email) { |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | /** |
172 | 172 | * @return User[] |
173 | 173 | */ |
174 | - public function getUsers () { |
|
174 | + public function getUsers() { |
|
175 | 175 | return $this->loadAll(User::class, "{$this}/users"); |
176 | 176 | } |
177 | 177 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return ProjectWebhook[]|TaskWebhook[] |
182 | 182 | */ |
183 | - public function getWebhooks () { |
|
183 | + public function getWebhooks() { |
|
184 | 184 | $all = $this->api->get('webhooks', ['workspace' => $this->getGid()], ['expand' => 'this']); |
185 | 185 | return array_map(function(array $each) { |
186 | 186 | return $this->api->getCache()->get($each['gid'], $this, function() use ($each) { |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | /** |
197 | 197 | * @return bool |
198 | 198 | */ |
199 | - public function isOrganization (): bool { |
|
199 | + public function isOrganization(): bool { |
|
200 | 200 | return $this->_is('is_organization'); |
201 | 201 | } |
202 | 202 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @return CustomField |
207 | 207 | */ |
208 | - public function newCustomField () { |
|
208 | + public function newCustomField() { |
|
209 | 209 | /** @var CustomField $field */ |
210 | 210 | $field = $this->factory(CustomField::class); |
211 | 211 | return $field->setWorkspace($this); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * |
217 | 217 | * @return Portfolio |
218 | 218 | */ |
219 | - public function newPortfolio () { |
|
219 | + public function newPortfolio() { |
|
220 | 220 | /** @var Portfolio $portfolio */ |
221 | 221 | $portfolio = $this->factory(Portfolio::class); |
222 | 222 | return $portfolio->setWorkspace($this); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * |
228 | 228 | * @return Project |
229 | 229 | */ |
230 | - public function newProject () { |
|
230 | + public function newProject() { |
|
231 | 231 | /** @var Project $project */ |
232 | 232 | $project = $this->factory(Project::class); |
233 | 233 | return $project->setWorkspace($this); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @return Tag |
240 | 240 | */ |
241 | - public function newTag () { |
|
241 | + public function newTag() { |
|
242 | 242 | /** @var Tag $tag */ |
243 | 243 | $tag = $this->factory(Tag::class); |
244 | 244 | return $tag->setWorkspace($this); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @return Task |
251 | 251 | */ |
252 | - public function newTask () { |
|
252 | + public function newTask() { |
|
253 | 253 | /** @var Task $task */ |
254 | 254 | $task = $this->factory(Task::class); |
255 | 255 | return $task->setWorkspace($this); |