@@ -13,7 +13,7 @@ |
||
13 | 13 | /** |
14 | 14 | * `DELETE` |
15 | 15 | */ |
16 | - public function delete (): void { |
|
16 | + public function delete(): void { |
|
17 | 17 | /** @var Api $api */ |
18 | 18 | $api = $this->api; |
19 | 19 | $api->delete($this); |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * |
16 | 16 | * @return $this |
17 | 17 | */ |
18 | - public function update () { |
|
18 | + public function update() { |
|
19 | 19 | if ($this->isDiff()) { |
20 | 20 | /** @var Api $api */ |
21 | 21 | $api = $this->api; |
@@ -49,21 +49,21 @@ |
||
49 | 49 | /** |
50 | 50 | * @return Api |
51 | 51 | */ |
52 | - final public static function getApi () { |
|
52 | + final public static function getApi() { |
|
53 | 53 | return static::getFacadeRoot(); |
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
57 | 57 | * @return string |
58 | 58 | */ |
59 | - public static function getFacadeAccessor () { |
|
59 | + public static function getFacadeAccessor() { |
|
60 | 60 | return AsanaServiceProvider::NAME; |
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
64 | 64 | * @return Api |
65 | 65 | */ |
66 | - public static function getFacadeRoot () { |
|
66 | + public static function getFacadeRoot() { |
|
67 | 67 | return parent::getFacadeRoot(); |
68 | 68 | } |
69 | 69 | } |
70 | 70 | \ No newline at end of file |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | |
24 | 24 | const TYPE = 'user'; |
25 | 25 | |
26 | - final public function __toString (): string { |
|
26 | + final public function __toString(): string { |
|
27 | 27 | return "users/{$this->getGid()}"; |
28 | 28 | } |
29 | 29 | |
30 | - protected function _getMap (): array { |
|
30 | + protected function _getMap(): array { |
|
31 | 31 | return [ |
32 | 32 | 'photo' => Photo::class, |
33 | 33 | 'workspaces' => [Workspace::class] |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param Workspace $workspace |
39 | 39 | * @return $this |
40 | 40 | */ |
41 | - public function addToWorkspace (Workspace $workspace) { |
|
41 | + public function addToWorkspace(Workspace $workspace) { |
|
42 | 42 | $this->api->post("{$workspace}/addUser", ['user' => $this->getGid()]); |
43 | 43 | $this->_merge('workspaces', [$workspace]); |
44 | 44 | return $this; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param Workspace $workspace |
49 | 49 | * @return Portfolio[] |
50 | 50 | */ |
51 | - public function getFavoritePortfolios (Workspace $workspace) { |
|
51 | + public function getFavoritePortfolios(Workspace $workspace) { |
|
52 | 52 | return $this->getFavorites(Portfolio::class, Portfolio::TYPE, $workspace); |
53 | 53 | } |
54 | 54 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param Workspace $workspace |
57 | 57 | * @return Project[] |
58 | 58 | */ |
59 | - public function getFavoriteProjects (Workspace $workspace) { |
|
59 | + public function getFavoriteProjects(Workspace $workspace) { |
|
60 | 60 | return $this->getFavorites(Project::class, Project::TYPE, $workspace); |
61 | 61 | } |
62 | 62 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param Workspace $workspace |
65 | 65 | * @return Tag[] |
66 | 66 | */ |
67 | - public function getFavoriteTags (Workspace $workspace) { |
|
67 | + public function getFavoriteTags(Workspace $workspace) { |
|
68 | 68 | return $this->getFavorites(Tag::class, Tag::TYPE, $workspace); |
69 | 69 | } |
70 | 70 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param Workspace $workspace |
73 | 73 | * @return Team[] |
74 | 74 | */ |
75 | - public function getFavoriteTeams (Workspace $workspace) { |
|
75 | + public function getFavoriteTeams(Workspace $workspace) { |
|
76 | 76 | return $this->getFavorites(Team::class, Team::TYPE, $workspace); |
77 | 77 | } |
78 | 78 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @param Workspace $workspace |
81 | 81 | * @return User[] |
82 | 82 | */ |
83 | - public function getFavoriteUsers (Workspace $workspace) { |
|
83 | + public function getFavoriteUsers(Workspace $workspace) { |
|
84 | 84 | return $this->getFavorites(self::class, self::TYPE, $workspace); |
85 | 85 | } |
86 | 86 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param Workspace $workspace |
91 | 91 | * @return array |
92 | 92 | */ |
93 | - protected function getFavorites (string $class, string $resourceType, Workspace $workspace) { |
|
93 | + protected function getFavorites(string $class, string $resourceType, Workspace $workspace) { |
|
94 | 94 | return $this->loadAll($class, "{$this}/favorites", [ |
95 | 95 | 'resource_type' => $resourceType, |
96 | 96 | 'workspace' => $workspace->getGid() |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @param Workspace $workspace |
106 | 106 | * @return Task[] |
107 | 107 | */ |
108 | - public function getIncompleteTasks (Workspace $workspace) { |
|
108 | + public function getIncompleteTasks(Workspace $workspace) { |
|
109 | 109 | return $this->loadAll(Task::class, 'tasks', [ |
110 | 110 | 'assignee' => $this->getGid(), |
111 | 111 | 'workspace' => $workspace->getGid(), |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param Workspace $workspace |
118 | 118 | * @return Portfolio[] |
119 | 119 | */ |
120 | - public function getPortfolios (Workspace $workspace) { |
|
120 | + public function getPortfolios(Workspace $workspace) { |
|
121 | 121 | return $this->loadAll(Portfolio::class, "portfolios", [ |
122 | 122 | 'workspace' => $workspace->getGid(), |
123 | 123 | 'owner' => $this->getGid() |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @param Workspace $workspace |
129 | 129 | * @return TaskList |
130 | 130 | */ |
131 | - public function getTaskList (Workspace $workspace) { |
|
131 | + public function getTaskList(Workspace $workspace) { |
|
132 | 132 | return $this->load(TaskList::class, "{$this}/user_task_list", [ |
133 | 133 | 'workspace' => $workspace->getGid() |
134 | 134 | ]); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param string[] $filter |
144 | 144 | * @return Task[] |
145 | 145 | */ |
146 | - public function getTasks (Workspace $workspace, array $filter = []) { |
|
146 | + public function getTasks(Workspace $workspace, array $filter = []) { |
|
147 | 147 | $filter['assignee'] = $this->getGid(); |
148 | 148 | $filter['workspace'] = $workspace->getGid(); |
149 | 149 | return $this->loadAll(Task::class, 'tasks', $filter); |
@@ -153,13 +153,13 @@ discard block |
||
153 | 153 | * @param Workspace $organization |
154 | 154 | * @return Team[] |
155 | 155 | */ |
156 | - public function getTeams (Workspace $organization) { |
|
156 | + public function getTeams(Workspace $organization) { |
|
157 | 157 | return $this->loadAll(Team::class, "{$this}/teams", [ |
158 | 158 | 'organization' => $organization->getGid() |
159 | 159 | ]); |
160 | 160 | } |
161 | 161 | |
162 | - public function getUrl (): string { |
|
162 | + public function getUrl(): string { |
|
163 | 163 | return "https://app.asana.com/0/{$this->getGid()}/list"; |
164 | 164 | } |
165 | 165 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @param Workspace $workspace |
168 | 168 | * @return $this |
169 | 169 | */ |
170 | - public function removeFromWorkspace (Workspace $workspace) { |
|
170 | + public function removeFromWorkspace(Workspace $workspace) { |
|
171 | 171 | $this->api->post("{$workspace}/removeUser", ['user' => $this->getGid()]); |
172 | 172 | $this->_remove('workspaces', [$workspace]); |
173 | 173 | return $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 | assert($this->isOrganization()); |
40 | 40 | /** @var OrganizationExport $export */ |
41 | 41 | $export = $this->factory(OrganizationExport::class); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param int $limit 1-100 |
54 | 54 | * @return array|AbstractEntity[] |
55 | 55 | */ |
56 | - protected function find (string $class, string $resourceType, string $text, int $limit = 20) { |
|
56 | + protected function find(string $class, string $resourceType, string $text, int $limit = 20) { |
|
57 | 57 | return $this->loadAll($class, "{$this}/typeahead", [ |
58 | 58 | 'resource_type' => $resourceType, |
59 | 59 | 'query' => $text, |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param int $limit 1-100 |
69 | 69 | * @return CustomField[] |
70 | 70 | */ |
71 | - public function findCustomFields (string $text, int $limit = 20) { |
|
71 | + public function findCustomFields(string $text, int $limit = 20) { |
|
72 | 72 | return $this->find(CustomField::class, CustomField::TYPE, $text, $limit); |
73 | 73 | } |
74 | 74 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @param int $limit 1-100 |
80 | 80 | * @return Portfolio[] |
81 | 81 | */ |
82 | - public function findPortfolios (string $text, int $limit = 20) { |
|
82 | + public function findPortfolios(string $text, int $limit = 20) { |
|
83 | 83 | return $this->find(Portfolio::class, Portfolio::TYPE, $text, $limit); |
84 | 84 | } |
85 | 85 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param int $limit 1-100 |
91 | 91 | * @return Project[] |
92 | 92 | */ |
93 | - public function findProjects (string $text, int $limit = 20) { |
|
93 | + public function findProjects(string $text, int $limit = 20) { |
|
94 | 94 | return $this->find(Project::class, Project::TYPE, $text, $limit); |
95 | 95 | } |
96 | 96 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @param int $limit 1-100 |
102 | 102 | * @return Tag[] |
103 | 103 | */ |
104 | - public function findTags (string $text, int $limit = 20) { |
|
104 | + public function findTags(string $text, int $limit = 20) { |
|
105 | 105 | return $this->find(Tag::class, Tag::TYPE, $text, $limit); |
106 | 106 | } |
107 | 107 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @param int $limit 1-100 |
113 | 113 | * @return Task[] |
114 | 114 | */ |
115 | - public function findTasks (string $text, int $limit = 20) { |
|
115 | + public function findTasks(string $text, int $limit = 20) { |
|
116 | 116 | return $this->find(Task::class, Task::TYPE, $text, $limit); |
117 | 117 | } |
118 | 118 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param int $limit 1-100 |
124 | 124 | * @return User[] |
125 | 125 | */ |
126 | - public function findUsers (string $text, int $limit = 20) { |
|
126 | + public function findUsers(string $text, int $limit = 20) { |
|
127 | 127 | return $this->find(User::class, User::TYPE, $text, $limit); |
128 | 128 | } |
129 | 129 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param array $filter |
132 | 132 | * @return Project[] |
133 | 133 | */ |
134 | - public function getProjects (array $filter = []) { |
|
134 | + public function getProjects(array $filter = []) { |
|
135 | 135 | $filter['workspace'] = $this->getGid(); |
136 | 136 | return $this->loadAll(Project::class, 'projects', $filter); |
137 | 137 | } |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | /** |
140 | 140 | * @return Tag[] |
141 | 141 | */ |
142 | - public function getTags () { |
|
142 | + public function getTags() { |
|
143 | 143 | return $this->loadAll(Tag::class, 'tags', ['workspace' => $this->getGid()]); |
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
147 | 147 | * @return Team[] |
148 | 148 | */ |
149 | - public function getTeams () { |
|
149 | + public function getTeams() { |
|
150 | 150 | return $this->loadAll(Team::class, "organizations/{$this->getGid()}/teams"); |
151 | 151 | } |
152 | 152 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @param string $email |
155 | 155 | * @return null|User |
156 | 156 | */ |
157 | - public function getUserByEmail (string $email) { |
|
157 | + public function getUserByEmail(string $email) { |
|
158 | 158 | return $this->api->getCache()->get($email, $this, function() use ($email) { |
159 | 159 | foreach ($this->getUsers() as $user) { |
160 | 160 | if ($user->getEmail() === $email) { |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | /** |
169 | 169 | * @return User[] |
170 | 170 | */ |
171 | - public function getUsers () { |
|
171 | + public function getUsers() { |
|
172 | 172 | return $this->loadAll(User::class, "{$this}/users"); |
173 | 173 | } |
174 | 174 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return ProjectWebhook[]|TaskWebhook[] |
179 | 179 | */ |
180 | - public function getWebhooks () { |
|
180 | + public function getWebhooks() { |
|
181 | 181 | $all = $this->api->get('webhooks', ['workspace' => $this->getGid()], ['expand' => 'this']); |
182 | 182 | return array_map(function(array $each) { |
183 | 183 | return $this->api->getCache()->get($each['gid'], $this, function() use ($each) { |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | /** |
194 | 194 | * @return bool |
195 | 195 | */ |
196 | - public function isOrganization (): bool { |
|
196 | + public function isOrganization(): bool { |
|
197 | 197 | return $this->_is('is_organization'); |
198 | 198 | } |
199 | 199 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return CustomField |
204 | 204 | */ |
205 | - public function newCustomField () { |
|
205 | + public function newCustomField() { |
|
206 | 206 | /** @var CustomField $field */ |
207 | 207 | $field = $this->factory(CustomField::class); |
208 | 208 | return $field->setWorkspace($this); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * |
214 | 214 | * @return Portfolio |
215 | 215 | */ |
216 | - public function newPortfolio () { |
|
216 | + public function newPortfolio() { |
|
217 | 217 | /** @var Portfolio $portfolio */ |
218 | 218 | $portfolio = $this->factory(Portfolio::class); |
219 | 219 | return $portfolio->setWorkspace($this); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @return Project |
226 | 226 | */ |
227 | - public function newProject () { |
|
227 | + public function newProject() { |
|
228 | 228 | /** @var Project $project */ |
229 | 229 | $project = $this->factory(Project::class); |
230 | 230 | return $project->setWorkspace($this); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @return Tag |
237 | 237 | */ |
238 | - public function newTag () { |
|
238 | + public function newTag() { |
|
239 | 239 | /** @var Tag $tag */ |
240 | 240 | $tag = $this->factory(Tag::class); |
241 | 241 | return $tag->setWorkspace($this); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * |
247 | 247 | * @return Task |
248 | 248 | */ |
249 | - public function newTask () { |
|
249 | + public function newTask() { |
|
250 | 250 | /** @var Task $task */ |
251 | 251 | $task = $this->factory(Task::class); |
252 | 252 | return $task->setWorkspace($this); |
@@ -15,14 +15,14 @@ |
||
15 | 15 | * |
16 | 16 | * @return string |
17 | 17 | */ |
18 | - abstract protected function _getDir (): string; |
|
18 | + abstract protected function _getDir(): string; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * `POST` |
22 | 22 | * |
23 | 23 | * @return $this |
24 | 24 | */ |
25 | - public function create () { |
|
25 | + public function create() { |
|
26 | 26 | /** @var Api $api */ |
27 | 27 | $api = $this->api; |
28 | 28 | $remote = $api->post($this->_getDir(), $this->getDiff(), ['expand' => 'this']); |
@@ -41,11 +41,9 @@ |
||
41 | 41 | if ($field['type'] === CustomField::TYPE_ENUM) { |
42 | 42 | $this->optionNames[$gid] = array_column($field['enum_options'], 'name', 'gid'); |
43 | 43 | $this->data[$gid] = $field['enum_value']['gid']; |
44 | - } |
|
45 | - elseif ($field['type'] === CustomField::TYPE_TEXT) { |
|
44 | + } elseif ($field['type'] === CustomField::TYPE_TEXT) { |
|
46 | 45 | $this->data[$gid] = $field['text_value']; |
47 | - } |
|
48 | - elseif ($field['type'] === CustomField::TYPE_NUMBER) { |
|
46 | + } elseif ($field['type'] === CustomField::TYPE_NUMBER) { |
|
49 | 47 | $this->data[$gid] = $field['number_value']; |
50 | 48 | } |
51 | 49 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | protected $task; |
41 | 41 | |
42 | - public function __construct (Task $task, array $fields) { |
|
42 | + public function __construct(Task $task, array $fields) { |
|
43 | 43 | parent::__construct($task); |
44 | 44 | $this->task = $task; |
45 | 45 | foreach ($fields as $field) { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | /** |
61 | 61 | * @return int |
62 | 62 | */ |
63 | - public function count () { |
|
63 | + public function count() { |
|
64 | 64 | return count($this->data); |
65 | 65 | } |
66 | 66 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param string $fieldName |
69 | 69 | * @return null|string |
70 | 70 | */ |
71 | - public function getGid (string $fieldName) { |
|
71 | + public function getGid(string $fieldName) { |
|
72 | 72 | return $this->gids[$fieldName] ?? null; |
73 | 73 | } |
74 | 74 | |
@@ -77,14 +77,14 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return string[] |
79 | 79 | */ |
80 | - public function getGids () { |
|
80 | + public function getGids() { |
|
81 | 81 | return $this->gids; |
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
85 | 85 | * @return Traversable |
86 | 86 | */ |
87 | - public function getIterator () { |
|
87 | + public function getIterator() { |
|
88 | 88 | return new ArrayIterator($this->data); |
89 | 89 | } |
90 | 90 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @param string $fieldGid |
93 | 93 | * @return null|string |
94 | 94 | */ |
95 | - public function getName (string $fieldGid): ?string { |
|
95 | + public function getName(string $fieldGid): ?string { |
|
96 | 96 | return array_search($fieldGid, $this->gids) ?: null; |
97 | 97 | } |
98 | 98 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return string[] |
103 | 103 | */ |
104 | - public function getNames () { |
|
104 | + public function getNames() { |
|
105 | 105 | return array_flip($this->gids); |
106 | 106 | } |
107 | 107 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @param string $optionName |
111 | 111 | * @return null|string |
112 | 112 | */ |
113 | - public function getOptionGid (string $enumGid, string $optionName) { |
|
113 | + public function getOptionGid(string $enumGid, string $optionName) { |
|
114 | 114 | return array_search($optionName, $this->optionNames[$enumGid]) ?: null; |
115 | 115 | } |
116 | 116 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @param string $enumGid |
121 | 121 | * @return string[] |
122 | 122 | */ |
123 | - public function getOptionGids (string $enumGid) { |
|
123 | + public function getOptionGids(string $enumGid) { |
|
124 | 124 | return array_flip($this->optionNames[$enumGid]); |
125 | 125 | } |
126 | 126 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @param string $optionGid |
130 | 130 | * @return null|string |
131 | 131 | */ |
132 | - public function getOptionName (string $enumGid, string $optionGid): ?string { |
|
132 | + public function getOptionName(string $enumGid, string $optionGid): ?string { |
|
133 | 133 | return $this->optionNames[$enumGid][$optionGid] ?? null; |
134 | 134 | } |
135 | 135 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @param string $enumGid |
140 | 140 | * @return string[] |
141 | 141 | */ |
142 | - public function getOptionNames (string $enumGid) { |
|
142 | + public function getOptionNames(string $enumGid) { |
|
143 | 143 | return $this->optionNames[$enumGid]; |
144 | 144 | } |
145 | 145 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @param string $fieldGid |
148 | 148 | * @return null|number|string |
149 | 149 | */ |
150 | - public function getValue (string $fieldGid) { |
|
150 | + public function getValue(string $fieldGid) { |
|
151 | 151 | return $this->data[$fieldGid] ?? null; |
152 | 152 | } |
153 | 153 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @param string $fieldGid |
156 | 156 | * @return bool |
157 | 157 | */ |
158 | - public function offsetExists ($fieldGid) { |
|
158 | + public function offsetExists($fieldGid) { |
|
159 | 159 | return array_key_exists($fieldGid, $this->data); |
160 | 160 | } |
161 | 161 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @param string $fieldGid |
164 | 164 | * @return null|number|string |
165 | 165 | */ |
166 | - public function offsetGet ($fieldGid) { |
|
166 | + public function offsetGet($fieldGid) { |
|
167 | 167 | return $this->getValue($fieldGid); |
168 | 168 | } |
169 | 169 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param string $fieldGid |
172 | 172 | * @param null|number|string $value |
173 | 173 | */ |
174 | - public function offsetSet ($fieldGid, $value) { |
|
174 | + public function offsetSet($fieldGid, $value) { |
|
175 | 175 | $this->setValue($fieldGid, $value); |
176 | 176 | } |
177 | 177 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @param string $fieldGid |
182 | 182 | */ |
183 | - public function offsetUnset ($fieldGid) { |
|
183 | + public function offsetUnset($fieldGid) { |
|
184 | 184 | $this->setValue($fieldGid, null); |
185 | 185 | } |
186 | 186 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * @param null|number|string $value |
190 | 190 | * @return $this |
191 | 191 | */ |
192 | - public function setValue (string $fieldGid, $value) { |
|
192 | + public function setValue(string $fieldGid, $value) { |
|
193 | 193 | $this->data[$fieldGid] = $value; |
194 | 194 | $this->diff[$fieldGid] = true; |
195 | 195 | $this->task->diff['custom_fields'] = true; |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | const LAYOUT_BOARD = 'board'; |
58 | 58 | const LAYOUT_LIST = 'list'; |
59 | 59 | |
60 | - final public function __toString (): string { |
|
60 | + final public function __toString(): string { |
|
61 | 61 | return "projects/{$this->getGid()}"; |
62 | 62 | } |
63 | 63 | |
64 | - final protected function _getDir (): string { |
|
64 | + final protected function _getDir(): string { |
|
65 | 65 | return 'projects'; |
66 | 66 | } |
67 | 67 | |
68 | - protected function _getMap (): array { |
|
68 | + protected function _getMap(): array { |
|
69 | 69 | return [ |
70 | 70 | 'current_status' => Status::class, |
71 | 71 | 'custom_fields' => [CustomField::class], |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param User $user |
83 | 83 | * @return $this |
84 | 84 | */ |
85 | - public function addMember (User $user) { |
|
85 | + public function addMember(User $user) { |
|
86 | 86 | return $this->addMembers([$user]); |
87 | 87 | } |
88 | 88 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @param User[] $users |
92 | 92 | * @return $this |
93 | 93 | */ |
94 | - public function addMembers (array $users) { |
|
94 | + public function addMembers(array $users) { |
|
95 | 95 | $this->api->post("{$this}/addMembers", ['members' => static::_getGids($users)]); |
96 | 96 | $this->_merge('members', $users); |
97 | 97 | return $this; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @param string $target |
103 | 103 | * @return ProjectWebhook |
104 | 104 | */ |
105 | - public function addWebhook (string $target) { |
|
105 | + public function addWebhook(string $target) { |
|
106 | 106 | /** @var ProjectWebhook $webhook */ |
107 | 107 | $webhook = $this->factory(ProjectWebhook::class); |
108 | 108 | return $webhook->create($this, $target); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @param array $schedule |
128 | 128 | * @return Job |
129 | 129 | */ |
130 | - public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) { |
|
130 | + public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) { |
|
131 | 131 | $data = ['name' => $name]; |
132 | 132 | if ($team) { |
133 | 133 | $data['team'] = $team->getGid(); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @param null|string $token |
150 | 150 | * @return ProjectEvent[]|TaskEvent[]|StoryEvent[] |
151 | 151 | */ |
152 | - public function getEvents (&$token) { |
|
152 | + public function getEvents(&$token) { |
|
153 | 153 | return $this->api->sync($this, $token); |
154 | 154 | } |
155 | 155 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @depends after-create |
158 | 158 | * @return Section[] |
159 | 159 | */ |
160 | - public function getSections () { |
|
160 | + public function getSections() { |
|
161 | 161 | return $this->loadAll(Section::class, "{$this}/sections"); |
162 | 162 | } |
163 | 163 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @depends after-create |
166 | 166 | * @return Status[] |
167 | 167 | */ |
168 | - public function getStatuses () { |
|
168 | + public function getStatuses() { |
|
169 | 169 | return $this->loadAll(Status::class, "{$this}/project_statuses"); |
170 | 170 | } |
171 | 171 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param array $query |
175 | 175 | * @return Task[] |
176 | 176 | */ |
177 | - public function getTasks (array $query = []) { |
|
177 | + public function getTasks(array $query = []) { |
|
178 | 178 | $query['project'] = $this->getGid(); |
179 | 179 | return $this->loadAll(Task::class, "tasks", $query); |
180 | 180 | } |
@@ -183,25 +183,25 @@ discard block |
||
183 | 183 | * @depends after-create |
184 | 184 | * @return string |
185 | 185 | */ |
186 | - public function getUrl (): string { |
|
186 | + public function getUrl(): string { |
|
187 | 187 | return "https://app.asana.com/0/{$this->getGid()}"; |
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
191 | 191 | * @return ProjectWebhook[] |
192 | 192 | */ |
193 | - public function getWebhooks () { |
|
193 | + public function getWebhooks() { |
|
194 | 194 | return $this->loadAll(ProjectWebhook::class, 'webhooks', [ |
195 | 195 | 'workspace' => $this->getWorkspace()->getGid(), |
196 | 196 | 'resource' => $this->getGid() |
197 | 197 | ]); |
198 | 198 | } |
199 | 199 | |
200 | - public function isBoard (): bool { |
|
200 | + public function isBoard(): bool { |
|
201 | 201 | return $this->getLayout() === self::LAYOUT_BOARD; |
202 | 202 | } |
203 | 203 | |
204 | - public function isList (): bool { |
|
204 | + public function isList(): bool { |
|
205 | 205 | return $this->getLayout() === self::LAYOUT_LIST; |
206 | 206 | } |
207 | 207 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @depends after-create |
210 | 210 | * @return Section |
211 | 211 | */ |
212 | - public function newSection () { |
|
212 | + public function newSection() { |
|
213 | 213 | return $this->factory(Section::class, ['projects' => [$this]]); |
214 | 214 | } |
215 | 215 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * @depends after-create |
218 | 218 | * @return Status |
219 | 219 | */ |
220 | - public function newStatus () { |
|
220 | + public function newStatus() { |
|
221 | 221 | return $this->factory(Status::class); |
222 | 222 | } |
223 | 223 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * @depends after-create |
228 | 228 | * @return Task |
229 | 229 | */ |
230 | - public function newTask () { |
|
230 | + public function newTask() { |
|
231 | 231 | return $this->getSections()[0]->newTask(); |
232 | 232 | } |
233 | 233 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * @param User $user |
237 | 237 | * @return $this |
238 | 238 | */ |
239 | - public function removeMember (User $user) { |
|
239 | + public function removeMember(User $user) { |
|
240 | 240 | return $this->removeMembers([$user]); |
241 | 241 | } |
242 | 242 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @param User[] $users |
246 | 246 | * @return $this |
247 | 247 | */ |
248 | - public function removeMembers (array $users) { |
|
248 | + public function removeMembers(array $users) { |
|
249 | 249 | $this->api->post("{$this}/removeMembers", ['members' => static::_getGids($users)]); |
250 | 250 | $this->_remove('members', $users); |
251 | 251 | return $this; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @param null|Team $team |
257 | 257 | * @return $this |
258 | 258 | */ |
259 | - public function setTeam (?Team $team) { |
|
259 | + public function setTeam(?Team $team) { |
|
260 | 260 | assert(!$this->hasGid()); |
261 | 261 | if ($team and !$this->hasWorkspace()) { |
262 | 262 | $this->setWorkspace($team->getOrganization()); |
@@ -24,15 +24,15 @@ discard block |
||
24 | 24 | |
25 | 25 | const TYPE = 'section'; |
26 | 26 | |
27 | - final public function __toString (): string { |
|
27 | + final public function __toString(): string { |
|
28 | 28 | return "sections/{$this->getGid()}"; |
29 | 29 | } |
30 | 30 | |
31 | - final protected function _getDir (): string { |
|
31 | + final protected function _getDir(): string { |
|
32 | 32 | return "{$this->getProject()}/sections"; |
33 | 33 | } |
34 | 34 | |
35 | - protected function _getMap (): array { |
|
35 | + protected function _getMap(): array { |
|
36 | 36 | return [ |
37 | 37 | 'project' => Project::class |
38 | 38 | ]; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * @return Task[] |
43 | 43 | */ |
44 | - public function getTasks () { |
|
44 | + public function getTasks() { |
|
45 | 45 | return $this->loadAll(Task::class, 'tasks', ['section' => $this->getGid()]); |
46 | 46 | } |
47 | 47 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @depends after-create |
52 | 52 | * @return Task |
53 | 53 | */ |
54 | - public function newTask () { |
|
54 | + public function newTask() { |
|
55 | 55 | /** @var Task $task */ |
56 | 56 | $task = $this->factory(Task::class); |
57 | 57 | return $task->addToProject($this); |