@@ -37,15 +37,15 @@ discard block |
||
37 | 37 | const TYPE_NUMBER = 'number'; |
38 | 38 | const TYPE_TEXT = 'text'; |
39 | 39 | |
40 | - final public function __toString (): string { |
|
40 | + final public function __toString(): string { |
|
41 | 41 | return "custom_fields/{$this->getGid()}"; |
42 | 42 | } |
43 | 43 | |
44 | - final protected function _getDir (): string { |
|
44 | + final protected function _getDir(): string { |
|
45 | 45 | return 'custom_fields'; |
46 | 46 | } |
47 | 47 | |
48 | - protected function _getMap (): array { |
|
48 | + protected function _getMap(): array { |
|
49 | 49 | return [ |
50 | 50 | 'enum_options' => [EnumOption::class], |
51 | 51 | 'enum_value' => EnumOption::class |
@@ -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); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return string |
79 | 79 | */ |
80 | - public function getValue () { |
|
80 | + public function getValue() { |
|
81 | 81 | switch ($this->getResourceSubtype()) { |
82 | 82 | case self::TYPE_ENUM: |
83 | 83 | return $this->getEnumValue()->getName(); |
@@ -89,28 +89,28 @@ discard block |
||
89 | 89 | /** |
90 | 90 | * @return bool |
91 | 91 | */ |
92 | - public function hasNotificationsEnabled (): bool { |
|
92 | + public function hasNotificationsEnabled(): bool { |
|
93 | 93 | return $this->_is('has_notifications_enabled'); |
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
97 | 97 | * @return bool |
98 | 98 | */ |
99 | - public function isEnum (): bool { |
|
99 | + public function isEnum(): bool { |
|
100 | 100 | return $this->getResourceSubtype() === self::TYPE_ENUM; |
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
104 | 104 | * @return bool |
105 | 105 | */ |
106 | - public function isGlobalToWorkspace (): bool { |
|
106 | + public function isGlobalToWorkspace(): bool { |
|
107 | 107 | return $this->_is('is_global_to_workspace'); |
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
111 | 111 | * @return bool |
112 | 112 | */ |
113 | - final public function isText (): bool { |
|
113 | + final public function isText(): bool { |
|
114 | 114 | return $this->getResourceSubtype() === self::TYPE_TEXT; |
115 | 115 | } |
116 | 116 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @param bool $flag |
119 | 119 | * @return $this |
120 | 120 | */ |
121 | - public function setGlobalToWorkspace (bool $flag) { |
|
121 | + public function setGlobalToWorkspace(bool $flag) { |
|
122 | 122 | return $this->_set('is_global_to_workspace', $flag); |
123 | 123 | } |
124 | 124 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param bool $flag |
127 | 127 | * @return $this |
128 | 128 | */ |
129 | - public function setNotificationsEnabled (bool $flag) { |
|
129 | + public function setNotificationsEnabled(bool $flag) { |
|
130 | 130 | return $this->_set('has_notifications_enabled', $flag); |
131 | 131 | } |
132 | 132 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @param string $value |
139 | 139 | * @return $this |
140 | 140 | */ |
141 | - public function setValue (string $value) { |
|
141 | + public function setValue(string $value) { |
|
142 | 142 | if ($this->isEnum()) { |
143 | 143 | foreach ($this->getEnumOptions() as $option) { |
144 | 144 | if ($value === $option->getName()) { |
@@ -62,8 +62,7 @@ |
||
62 | 62 | $option->setName($name); |
63 | 63 | if ($this->hasGid()) { |
64 | 64 | $option->create(); |
65 | - } |
|
66 | - else { |
|
65 | + } else { |
|
67 | 66 | $this->diff['enum_options'] = true; |
68 | 67 | } |
69 | 68 | $this->data['enum_options'][] = $option; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * @param string $token |
42 | 42 | */ |
43 | - public function __construct (string $token) { |
|
43 | + public function __construct(string $token) { |
|
44 | 44 | $this->token = $token; |
45 | 45 | $this->cache = new Cache(); |
46 | 46 | $this->logger = new Logger(); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @param string $path |
53 | 53 | */ |
54 | - public function delete (string $path): void { |
|
54 | + public function delete(string $path): void { |
|
55 | 55 | $this->exec('DELETE', $path); |
56 | 56 | } |
57 | 57 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @return null|array |
63 | 63 | * @internal |
64 | 64 | */ |
65 | - protected function exec (string $method, string $path, array $opts = null) { |
|
65 | + protected function exec(string $method, string $path, array $opts = null) { |
|
66 | 66 | $ch = curl_init(); |
67 | 67 | curl_setopt_array($ch, [ |
68 | 68 | CURLOPT_CUSTOMREQUEST => $method, |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param array $data |
114 | 114 | * @return mixed |
115 | 115 | */ |
116 | - public function factory (string $class, $caller, array $data = []) { |
|
116 | + public function factory(string $class, $caller, array $data = []) { |
|
117 | 117 | return new $class($caller, $data); |
118 | 118 | } |
119 | 119 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @param array $options |
126 | 126 | * @return null|array |
127 | 127 | */ |
128 | - public function get (string $path, array $query = [], array $options = []) { |
|
128 | + public function get(string $path, array $query = [], array $options = []) { |
|
129 | 129 | foreach ($options as $name => $value) { |
130 | 130 | $query["opt_{$name}"] = $value; |
131 | 131 | } |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | * @param string $gid |
140 | 140 | * @return null|Attachment |
141 | 141 | */ |
142 | - public function getAttachment (string $gid) { |
|
142 | + public function getAttachment(string $gid) { |
|
143 | 143 | return $this->load(Attachment::class, $this, "attachments/{$gid}"); |
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
147 | 147 | * @return Cache |
148 | 148 | */ |
149 | - public function getCache () { |
|
149 | + public function getCache() { |
|
150 | 150 | return $this->cache; |
151 | 151 | } |
152 | 152 | |
@@ -156,14 +156,14 @@ discard block |
||
156 | 156 | * @param string $gid |
157 | 157 | * @return null|CustomField |
158 | 158 | */ |
159 | - public function getCustomField (string $gid) { |
|
159 | + public function getCustomField(string $gid) { |
|
160 | 160 | return $this->load(CustomField::class, $this, "custom_fields/{$gid}"); |
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
164 | 164 | * @return LoggerInterface |
165 | 165 | */ |
166 | - public function getLogger () { |
|
166 | + public function getLogger() { |
|
167 | 167 | return $this->logger; |
168 | 168 | } |
169 | 169 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return User |
174 | 174 | */ |
175 | - public function getMe () { |
|
175 | + public function getMe() { |
|
176 | 176 | return $this->getUser('me'); |
177 | 177 | } |
178 | 178 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @param array $query |
184 | 184 | * @return string |
185 | 185 | */ |
186 | - protected function getPath (string $path, array $query): string { |
|
186 | + protected function getPath(string $path, array $query): string { |
|
187 | 187 | return $query ? $path . '?' . http_build_query($query) : $path; |
188 | 188 | } |
189 | 189 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * @param string $gid |
194 | 194 | * @return null|Portfolio |
195 | 195 | */ |
196 | - public function getPortfolio (string $gid) { |
|
196 | + public function getPortfolio(string $gid) { |
|
197 | 197 | return $this->load(Portfolio::class, $this, "portfolios/{$gid}"); |
198 | 198 | } |
199 | 199 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @param string $gid |
204 | 204 | * @return null|Project |
205 | 205 | */ |
206 | - public function getProject (string $gid) { |
|
206 | + public function getProject(string $gid) { |
|
207 | 207 | return $this->load(Project::class, $this, "projects/{$gid}"); |
208 | 208 | } |
209 | 209 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param string $gid |
214 | 214 | * @return null|Section |
215 | 215 | */ |
216 | - public function getSection (string $gid) { |
|
216 | + public function getSection(string $gid) { |
|
217 | 217 | return $this->load(Section::class, $this, "sections/{$gid}"); |
218 | 218 | } |
219 | 219 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * @param string $gid |
224 | 224 | * @return null|Story |
225 | 225 | */ |
226 | - public function getStory (string $gid) { |
|
226 | + public function getStory(string $gid) { |
|
227 | 227 | return $this->load(Story::class, $this, "stories/{$gid}"); |
228 | 228 | } |
229 | 229 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @param string $gid |
234 | 234 | * @return null|Tag |
235 | 235 | */ |
236 | - public function getTag (string $gid) { |
|
236 | + public function getTag(string $gid) { |
|
237 | 237 | return $this->load(Tag::class, $this, "tags/{$gid}"); |
238 | 238 | } |
239 | 239 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @param string $gid |
244 | 244 | * @return null|Task |
245 | 245 | */ |
246 | - public function getTask (string $gid) { |
|
246 | + public function getTask(string $gid) { |
|
247 | 247 | return $this->load(Task::class, $this, "tasks/{$gid}"); |
248 | 248 | } |
249 | 249 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @param string $gid |
254 | 254 | * @return null|Team |
255 | 255 | */ |
256 | - public function getTeam (string $gid) { |
|
256 | + public function getTeam(string $gid) { |
|
257 | 257 | return $this->load(Team::class, $this, "teams/{$gid}"); |
258 | 258 | } |
259 | 259 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * @param string $gid |
264 | 264 | * @return null|User |
265 | 265 | */ |
266 | - public function getUser (string $gid) { |
|
266 | + public function getUser(string $gid) { |
|
267 | 267 | return $this->load(User::class, $this, "users/{$gid}"); |
268 | 268 | } |
269 | 269 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @param string $email |
272 | 272 | * @return null|User |
273 | 273 | */ |
274 | - public function getUserByEmail (string $email) { |
|
274 | + public function getUserByEmail(string $email) { |
|
275 | 275 | return $this->cache->get($email, $this, function() use ($email) { |
276 | 276 | foreach ($this->getUsers() as $user) { |
277 | 277 | if ($user->getEmail() === $email) { |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * |
288 | 288 | * @return User[] |
289 | 289 | */ |
290 | - public function getUsers () { |
|
290 | + public function getUsers() { |
|
291 | 291 | return $this->loadAll(User::class, $this, 'users'); |
292 | 292 | } |
293 | 293 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @param array $data |
300 | 300 | * @return ProjectEvent|TaskEvent|StoryEvent |
301 | 301 | */ |
302 | - public function getWebhookEvent (array $data) { |
|
302 | + public function getWebhookEvent(array $data) { |
|
303 | 303 | static $classes = [ |
304 | 304 | Project::TYPE => ProjectEvent::class, |
305 | 305 | Task::TYPE => TaskEvent::class, |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * @param string $gid |
313 | 313 | * @return null|Workspace |
314 | 314 | */ |
315 | - public function getWorkspace (string $gid) { |
|
315 | + public function getWorkspace(string $gid) { |
|
316 | 316 | return $this->load(Workspace::class, $this, "workspaces/{$gid}"); |
317 | 317 | } |
318 | 318 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * @param string $name |
321 | 321 | * @return null|Workspace |
322 | 322 | */ |
323 | - public function getWorkspaceByName (string $name) { |
|
323 | + public function getWorkspaceByName(string $name) { |
|
324 | 324 | foreach ($this->getMe()->getWorkspaces() as $workspace) { |
325 | 325 | if ($workspace->getName() === $name) { |
326 | 326 | return $workspace; |
@@ -333,16 +333,16 @@ discard block |
||
333 | 333 | * @param string $json |
334 | 334 | * @return null|array |
335 | 335 | */ |
336 | - protected function jsonDecode (string $json) { |
|
337 | - return json_decode($json, true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR); |
|
336 | + protected function jsonDecode(string $json) { |
|
337 | + return json_decode($json, true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | /** |
341 | 341 | * @param array $data |
342 | 342 | * @return string |
343 | 343 | */ |
344 | - protected function jsonEncode (array $data): string { |
|
345 | - return json_encode($data, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR); |
|
344 | + protected function jsonEncode(array $data): string { |
|
345 | + return json_encode($data, JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | * @param array $query |
357 | 357 | * @return null|mixed|AbstractEntity |
358 | 358 | */ |
359 | - public function load (string $class, $caller, string $path, array $query = []) { |
|
359 | + public function load(string $class, $caller, string $path, array $query = []) { |
|
360 | 360 | $key = $this->getPath($path, $query); |
361 | 361 | return $this->cache->get($key, $caller, function($caller) use ($class, $path, $query) { |
362 | 362 | $data = $this->get($path, $query, ['expand' => 'this']); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | * @param int $pages If positive, stops after this many pages have been fetched. |
377 | 377 | * @return array|AbstractEntity[] |
378 | 378 | */ |
379 | - public function loadAll (string $class, $caller, string $path, array $query = [], int $pages = 0) { |
|
379 | + public function loadAll(string $class, $caller, string $path, array $query = [], int $pages = 0) { |
|
380 | 380 | $query['opt_expand'] = 'this'; |
381 | 381 | $query += ['limit' => 100]; |
382 | 382 | $path = $this->getPath($path, $query); |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | * @param array $options |
403 | 403 | * @return null|array |
404 | 404 | */ |
405 | - public function post (string $path, array $data = [], array $options = []) { |
|
405 | + public function post(string $path, array $data = [], array $options = []) { |
|
406 | 406 | $response = $this->exec('POST', $path, [ |
407 | 407 | CURLOPT_HTTPHEADER => ['Content-Type: application/json'], |
408 | 408 | CURLOPT_POSTFIELDS => $this->jsonEncode(['options' => $options, 'data' => $data]) |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * @param array $options |
419 | 419 | * @return null|array |
420 | 420 | */ |
421 | - public function put (string $path, array $data = [], array $options = []) { |
|
421 | + public function put(string $path, array $data = [], array $options = []) { |
|
422 | 422 | $response = $this->exec('PUT', $path, [ |
423 | 423 | CURLOPT_HTTPHEADER => ['Content-Type: application/json'], |
424 | 424 | CURLOPT_POSTFIELDS => $this->jsonEncode(['options' => $options, 'data' => $data]) |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | * @param Cache $cache |
431 | 431 | * @return $this |
432 | 432 | */ |
433 | - public function setCache (Cache $cache) { |
|
433 | + public function setCache(Cache $cache) { |
|
434 | 434 | $this->cache = $cache; |
435 | 435 | return $this; |
436 | 436 | } |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | * @param LoggerInterface $logger |
440 | 440 | * @return $this |
441 | 441 | */ |
442 | - public function setLogger (LoggerInterface $logger) { |
|
442 | + public function setLogger(LoggerInterface $logger) { |
|
443 | 443 | $this->logger = $logger; |
444 | 444 | return $this; |
445 | 445 | } |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * @param string $token |
454 | 454 | * @return ProjectEvent[]|TaskEvent[]|StoryEvent[] |
455 | 455 | */ |
456 | - public function sync ($entity, &$token) { |
|
456 | + public function sync($entity, &$token) { |
|
457 | 457 | try { |
458 | 458 | $response = $this->exec('GET', $this->getPath('events', [ |
459 | 459 | 'resource' => $entity->getGid(), |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | * @param string $file |
486 | 486 | * @return null|array |
487 | 487 | */ |
488 | - public function upload (string $path, string $file) { |
|
488 | + public function upload(string $path, string $file) { |
|
489 | 489 | $response = $this->exec('POST', $path, [ |
490 | 490 | CURLOPT_POSTFIELDS => ['file' => new CURLFile(realpath($file))] // multipart/form-data |
491 | 491 | ]); |
@@ -460,8 +460,7 @@ |
||
460 | 460 | 'sync' => $token, |
461 | 461 | 'opt_expand' => 'this' |
462 | 462 | ])); |
463 | - } |
|
464 | - catch (Error $error) { |
|
463 | + } catch (Error $error) { |
|
465 | 464 | if ($error->getCode() !== 412) { |
466 | 465 | throw $error; |
467 | 466 | } |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | const LAYOUT_BOARD = 'board'; |
57 | 57 | const LAYOUT_LIST = 'list'; |
58 | 58 | |
59 | - final public function __toString (): string { |
|
59 | + final public function __toString(): string { |
|
60 | 60 | return "projects/{$this->getGid()}"; |
61 | 61 | } |
62 | 62 | |
63 | - final protected function _getDir (): string { |
|
63 | + final protected function _getDir(): string { |
|
64 | 64 | return 'projects'; |
65 | 65 | } |
66 | 66 | |
67 | - protected function _getMap (): array { |
|
67 | + protected function _getMap(): array { |
|
68 | 68 | return [ |
69 | 69 | 'current_status' => Status::class, |
70 | 70 | 'custom_fields' => [CustomField::class], |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @param User $user |
82 | 82 | * @return $this |
83 | 83 | */ |
84 | - public function addMember (User $user) { |
|
84 | + public function addMember(User $user) { |
|
85 | 85 | return $this->addMembers([$user]); |
86 | 86 | } |
87 | 87 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param User[] $users |
91 | 91 | * @return $this |
92 | 92 | */ |
93 | - public function addMembers (array $users) { |
|
93 | + public function addMembers(array $users) { |
|
94 | 94 | $this->api->post("{$this}/addMembers", ['members' => static::_getGids($users)]); |
95 | 95 | $this->_merge('members', $users); |
96 | 96 | return $this; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @param string $target |
102 | 102 | * @return ProjectWebhook |
103 | 103 | */ |
104 | - public function addWebhook (string $target) { |
|
104 | + public function addWebhook(string $target) { |
|
105 | 105 | /** @var ProjectWebhook $webhook */ |
106 | 106 | $webhook = $this->factory(ProjectWebhook::class); |
107 | 107 | return $webhook->create($this, $target); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param array $schedule |
127 | 127 | * @return Job |
128 | 128 | */ |
129 | - public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) { |
|
129 | + public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) { |
|
130 | 130 | $data = ['name' => $name]; |
131 | 131 | if ($team) { |
132 | 132 | $data['team'] = $team->getGid(); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param string $token |
147 | 147 | * @return ProjectEvent[]|TaskEvent[]|StoryEvent[] |
148 | 148 | */ |
149 | - public function getEvents (string &$token) { |
|
149 | + public function getEvents(string &$token) { |
|
150 | 150 | return $this->api->sync($this, $token); |
151 | 151 | } |
152 | 152 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @after-create |
155 | 155 | * @return Section[] |
156 | 156 | */ |
157 | - public function getSections () { |
|
157 | + public function getSections() { |
|
158 | 158 | return $this->loadAll(Section::class, "{$this}/sections"); |
159 | 159 | } |
160 | 160 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @after-create |
163 | 163 | * @return Status[] |
164 | 164 | */ |
165 | - public function getStatuses () { |
|
165 | + public function getStatuses() { |
|
166 | 166 | return $this->loadAll(Status::class, "{$this}/project_statuses"); |
167 | 167 | } |
168 | 168 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param array $query |
172 | 172 | * @return Task[] |
173 | 173 | */ |
174 | - public function getTasks (array $query = []) { |
|
174 | + public function getTasks(array $query = []) { |
|
175 | 175 | $query['project'] = $this->getGid(); |
176 | 176 | return $this->loadAll(Task::class, "tasks", $query); |
177 | 177 | } |
@@ -180,25 +180,25 @@ discard block |
||
180 | 180 | * @after-create |
181 | 181 | * @return string |
182 | 182 | */ |
183 | - public function getUrl (): string { |
|
183 | + public function getUrl(): string { |
|
184 | 184 | return "https://app.asana.com/0/{$this->getGid()}"; |
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
188 | 188 | * @return ProjectWebhook[] |
189 | 189 | */ |
190 | - public function getWebhooks () { |
|
190 | + public function getWebhooks() { |
|
191 | 191 | return $this->loadAll(ProjectWebhook::class, 'webhooks', [ |
192 | 192 | 'workspace' => $this->getWorkspace()->getGid(), |
193 | 193 | 'resource' => $this->getGid() |
194 | 194 | ]); |
195 | 195 | } |
196 | 196 | |
197 | - public function isBoard (): bool { |
|
197 | + public function isBoard(): bool { |
|
198 | 198 | return $this->getLayout() === self::LAYOUT_BOARD; |
199 | 199 | } |
200 | 200 | |
201 | - public function isList (): bool { |
|
201 | + public function isList(): bool { |
|
202 | 202 | return $this->getLayout() === self::LAYOUT_LIST; |
203 | 203 | } |
204 | 204 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * @after-create |
207 | 207 | * @return Section |
208 | 208 | */ |
209 | - public function newSection () { |
|
209 | + public function newSection() { |
|
210 | 210 | return $this->factory(Section::class, ['projects' => [$this]]); |
211 | 211 | } |
212 | 212 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @after-create |
215 | 215 | * @return Status |
216 | 216 | */ |
217 | - public function newStatus () { |
|
217 | + public function newStatus() { |
|
218 | 218 | return $this->factory(Status::class); |
219 | 219 | } |
220 | 220 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * @after-create |
225 | 225 | * @return Task |
226 | 226 | */ |
227 | - public function newTask () { |
|
227 | + public function newTask() { |
|
228 | 228 | return $this->getSections()[0]->newTask(); |
229 | 229 | } |
230 | 230 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @param User $user |
234 | 234 | * @return $this |
235 | 235 | */ |
236 | - public function removeMember (User $user) { |
|
236 | + public function removeMember(User $user) { |
|
237 | 237 | return $this->removeMembers([$user]); |
238 | 238 | } |
239 | 239 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @param User[] $users |
243 | 243 | * @return $this |
244 | 244 | */ |
245 | - public function removeMembers (array $users) { |
|
245 | + public function removeMembers(array $users) { |
|
246 | 246 | $this->api->post("{$this}/removeMembers", ['members' => static::_getGids($users)]); |
247 | 247 | $this->_remove('members', $users); |
248 | 248 | return $this; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @param null|Team $team |
254 | 254 | * @return $this |
255 | 255 | */ |
256 | - public function setTeam (?Team $team) { |
|
256 | + public function setTeam(?Team $team) { |
|
257 | 257 | assert(!$this->hasGid()); |
258 | 258 | if ($team and !$this->hasWorkspace()) { |
259 | 259 | $this->setWorkspace($team->getOrganization()); |
@@ -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,35 +123,35 @@ 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 | |
130 | 130 | /** |
131 | 131 | * @return Project[] |
132 | 132 | */ |
133 | - public function getProjects () { |
|
133 | + public function getProjects() { |
|
134 | 134 | return $this->loadAll(Project::class, 'projects', ['workspace' => $this->getGid()]); |
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
138 | 138 | * @return Tag[] |
139 | 139 | */ |
140 | - public function getTags () { |
|
140 | + public function getTags() { |
|
141 | 141 | return $this->loadAll(Tag::class, 'tags', ['workspace' => $this->getGid()]); |
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
145 | 145 | * @return Team[] |
146 | 146 | */ |
147 | - public function getTeams () { |
|
147 | + public function getTeams() { |
|
148 | 148 | return $this->loadAll(Team::class, "organizations/{$this->getGid()}/teams"); |
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
152 | 152 | * @return User[] |
153 | 153 | */ |
154 | - public function getUsers () { |
|
154 | + public function getUsers() { |
|
155 | 155 | return $this->loadAll(User::class, "{$this}/users"); |
156 | 156 | } |
157 | 157 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @return ProjectWebhook[]|TaskWebhook[] |
162 | 162 | */ |
163 | - public function getWebhooks () { |
|
163 | + public function getWebhooks() { |
|
164 | 164 | $all = $this->api->get('webhooks', ['workspace' => $this->getGid()], ['expand' => 'this']); |
165 | 165 | return array_map(function(array $each) { |
166 | 166 | return $this->api->getCache()->get($each['gid'], $this, function() use ($each) { |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | /** |
177 | 177 | * @return bool |
178 | 178 | */ |
179 | - public function isOrganization (): bool { |
|
179 | + public function isOrganization(): bool { |
|
180 | 180 | return $this->_is('is_organization'); |
181 | 181 | } |
182 | 182 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * |
186 | 186 | * @return CustomField |
187 | 187 | */ |
188 | - public function newCustomField () { |
|
188 | + public function newCustomField() { |
|
189 | 189 | /** @var CustomField $field */ |
190 | 190 | $field = $this->factory(CustomField::class); |
191 | 191 | return $field->setWorkspace($this); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return Portfolio |
198 | 198 | */ |
199 | - public function newPortfolio () { |
|
199 | + public function newPortfolio() { |
|
200 | 200 | /** @var Portfolio $portfolio */ |
201 | 201 | $portfolio = $this->factory(Portfolio::class); |
202 | 202 | return $portfolio->setWorkspace($this); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return Project |
209 | 209 | */ |
210 | - public function newProject () { |
|
210 | + public function newProject() { |
|
211 | 211 | /** @var Project $project */ |
212 | 212 | $project = $this->factory(Project::class); |
213 | 213 | return $project->setWorkspace($this); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @return Tag |
220 | 220 | */ |
221 | - public function newTag () { |
|
221 | + public function newTag() { |
|
222 | 222 | /** @var Tag $tag */ |
223 | 223 | $tag = $this->factory(Tag::class); |
224 | 224 | return $tag->setWorkspace($this); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @return Task |
231 | 231 | */ |
232 | - public function newTask () { |
|
232 | + public function newTask() { |
|
233 | 233 | /** @var Task $task */ |
234 | 234 | $task = $this->factory(Task::class); |
235 | 235 | return $task->setWorkspace($this); |
@@ -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 | ]); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param Workspace $workspace |
143 | 143 | * @return Task[] |
144 | 144 | */ |
145 | - public function getTasks (Workspace $workspace) { |
|
145 | + public function getTasks(Workspace $workspace) { |
|
146 | 146 | return $this->loadAll(Task::class, 'tasks', [ |
147 | 147 | 'assignee' => $this->getGid(), |
148 | 148 | 'workspace' => $workspace->getGid() |
@@ -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; |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | |
26 | 26 | const TYPE = 'user_task_list'; |
27 | 27 | |
28 | - final public function __toString (): string { |
|
28 | + final public function __toString(): string { |
|
29 | 29 | return "user_task_lists/{$this->getGid()}"; |
30 | 30 | } |
31 | 31 | |
32 | - protected function _getMap (): array { |
|
32 | + protected function _getMap(): array { |
|
33 | 33 | return [ |
34 | 34 | 'owner' => User::class, |
35 | 35 | 'workspace' => Workspace::class |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | /** |
40 | 40 | * @return Task[] |
41 | 41 | */ |
42 | - public function getIncompleteTasks () { |
|
42 | + public function getIncompleteTasks() { |
|
43 | 43 | return $this->loadAll(Task::class, "{$this}/tasks", ['completed_since' => 'now']); |
44 | 44 | } |
45 | 45 | |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return ArrayIterator|Task[] |
50 | 50 | */ |
51 | - public function getIterator () { |
|
51 | + public function getIterator() { |
|
52 | 52 | return new ArrayIterator($this->getTasks()); |
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | 56 | * @return Task[] |
57 | 57 | */ |
58 | - public function getTasks () { |
|
58 | + public function getTasks() { |
|
59 | 59 | return $this->loadAll(Task::class, "{$this}/tasks"); |
60 | 60 | } |
61 | 61 | } |
62 | 62 | \ No newline at end of file |
@@ -67,15 +67,15 @@ discard block |
||
67 | 67 | const ASSIGN_TODAY = 'today'; |
68 | 68 | const ASSIGN_UPCOMING = 'upcoming'; |
69 | 69 | |
70 | - final public function __toString (): string { |
|
70 | + final public function __toString(): string { |
|
71 | 71 | return "tasks/{$this->getGid()}"; |
72 | 72 | } |
73 | 73 | |
74 | - final protected function _getDir (): string { |
|
74 | + final protected function _getDir(): string { |
|
75 | 75 | return 'tasks'; |
76 | 76 | } |
77 | 77 | |
78 | - protected function _getMap (): array { |
|
78 | + protected function _getMap(): array { |
|
79 | 79 | return [ |
80 | 80 | 'assignee' => User::class, |
81 | 81 | 'custom_fields' => [CustomField::class], |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @param string $file |
97 | 97 | * @return Attachment |
98 | 98 | */ |
99 | - public function addAttachment (string $file) { |
|
99 | + public function addAttachment(string $file) { |
|
100 | 100 | /** @var Attachment $attachment */ |
101 | 101 | $attachment = $this->factory(Attachment::class, ['parent' => $this]); |
102 | 102 | return $attachment->upload($file); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @param string $text |
110 | 110 | * @return Story |
111 | 111 | */ |
112 | - public function addComment (string $text) { |
|
112 | + public function addComment(string $text) { |
|
113 | 113 | return $this->newComment()->setText($text)->create(); |
114 | 114 | } |
115 | 115 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @param Task[] $tasks |
121 | 121 | * @return $this |
122 | 122 | */ |
123 | - public function addDependencies (array $tasks) { |
|
123 | + public function addDependencies(array $tasks) { |
|
124 | 124 | $this->api->post("{$this}/addDependencies", ['dependents' => static::_getGids($tasks)]); |
125 | 125 | return $this; |
126 | 126 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @param Task $task |
133 | 133 | * @return $this |
134 | 134 | */ |
135 | - public function addDependency (Task $task) { |
|
135 | + public function addDependency(Task $task) { |
|
136 | 136 | return $this->addDependencies([$task]); |
137 | 137 | } |
138 | 138 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param Task $task |
144 | 144 | * @return $this |
145 | 145 | */ |
146 | - public function addDependent (Task $task) { |
|
146 | + public function addDependent(Task $task) { |
|
147 | 147 | return $this->addDependents([$task]); |
148 | 148 | } |
149 | 149 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @param Task[] $tasks |
155 | 155 | * @return $this |
156 | 156 | */ |
157 | - public function addDependents (array $tasks) { |
|
157 | + public function addDependents(array $tasks) { |
|
158 | 158 | $this->api->post("{$this}/addDependents", ['dependents' => static::_getGids($tasks)]); |
159 | 159 | return $this; |
160 | 160 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @param User $user |
166 | 166 | * @return $this |
167 | 167 | */ |
168 | - public function addFollower (User $user) { |
|
168 | + public function addFollower(User $user) { |
|
169 | 169 | return $this->addFollowers([$user]); |
170 | 170 | } |
171 | 171 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * @param User[] $users |
176 | 176 | * @return $this |
177 | 177 | */ |
178 | - public function addFollowers (array $users) { |
|
178 | + public function addFollowers(array $users) { |
|
179 | 179 | if ($this->hasGid()) { |
180 | 180 | $this->api->post("{$this}/addFollowers", ['followers' => static::_getGids($users)]); |
181 | 181 | $this->_merge('followers', $users); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @param Tag $tag |
193 | 193 | * @return $this |
194 | 194 | */ |
195 | - public function addTag (Tag $tag) { |
|
195 | + public function addTag(Tag $tag) { |
|
196 | 196 | if ($this->hasGid()) { |
197 | 197 | $this->api->post("{$this}/addTag", ['tag' => $tag->getGid()]); |
198 | 198 | $this->_merge('tags', [$tag]); |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @param Section $section |
210 | 210 | * @return $this |
211 | 211 | */ |
212 | - public function addToProject (Section $section) { |
|
212 | + public function addToProject(Section $section) { |
|
213 | 213 | $project = $section->getProject(); |
214 | 214 | if ($this->hasGid()) { |
215 | 215 | $this->api->post("{$this}/addProject", [ |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @param string $target |
244 | 244 | * @return TaskWebhook |
245 | 245 | */ |
246 | - public function addWebhook (string $target) { |
|
246 | + public function addWebhook(string $target) { |
|
247 | 247 | /** @var TaskWebhook $webhook */ |
248 | 248 | $webhook = $this->factory(TaskWebhook::class); |
249 | 249 | return $webhook->create($this, $target); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * @param string[] $include |
260 | 260 | * @return Job |
261 | 261 | */ |
262 | - public function duplicate (string $name, array $include) { |
|
262 | + public function duplicate(string $name, array $include) { |
|
263 | 263 | $remote = $this->api->post("{$this}/duplicate", [ |
264 | 264 | 'name' => $name, |
265 | 265 | 'include' => array_values($include) |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @after-create |
274 | 274 | * @return Attachment[] |
275 | 275 | */ |
276 | - public function getAttachments () { |
|
276 | + public function getAttachments() { |
|
277 | 277 | return $this->loadAll(Attachment::class, "{$this}/attachments"); |
278 | 278 | } |
279 | 279 | |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * @after-create |
284 | 284 | * @return Story[] |
285 | 285 | */ |
286 | - public function getComments () { |
|
286 | + public function getComments() { |
|
287 | 287 | return array_values(array_filter($this->getStories(), function(Story $story) { |
288 | 288 | return $story->isComment(); |
289 | 289 | })); |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | * @after-create |
296 | 296 | * @return Task[] |
297 | 297 | */ |
298 | - public function getDependencies () { |
|
298 | + public function getDependencies() { |
|
299 | 299 | return $this->loadAll(self::class, "{$this}/dependencies"); |
300 | 300 | } |
301 | 301 | |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | * @after-create |
306 | 306 | * @return Task[] |
307 | 307 | */ |
308 | - public function getDependents () { |
|
308 | + public function getDependents() { |
|
309 | 309 | return $this->loadAll(self::class, "{$this}/dependents"); |
310 | 310 | } |
311 | 311 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * @param string $token |
317 | 317 | * @return TaskEvent[]|StoryEvent[] |
318 | 318 | */ |
319 | - public function getEvents (string &$token) { |
|
319 | + public function getEvents(string &$token) { |
|
320 | 320 | return $this->api->sync($this, $token); |
321 | 321 | } |
322 | 322 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @after-create |
327 | 327 | * @return Story[] |
328 | 328 | */ |
329 | - public function getStories () { |
|
329 | + public function getStories() { |
|
330 | 330 | return $this->loadAll(Story::class, "{$this}/stories"); |
331 | 331 | } |
332 | 332 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | * @after-create |
337 | 337 | * @return Task[] |
338 | 338 | */ |
339 | - public function getSubTasks () { |
|
339 | + public function getSubTasks() { |
|
340 | 340 | return $this->loadAll(self::class, "{$this}/subtasks"); |
341 | 341 | } |
342 | 342 | |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | * @after-create |
347 | 347 | * @return string |
348 | 348 | */ |
349 | - public function getUrl (): string { |
|
349 | + public function getUrl(): string { |
|
350 | 350 | return "https://app.asana.com/0/0/{$this->getGid()}"; |
351 | 351 | } |
352 | 352 | |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | * @after-create |
357 | 357 | * @return TaskWebhook[] |
358 | 358 | */ |
359 | - public function getWebhooks () { |
|
359 | + public function getWebhooks() { |
|
360 | 360 | return $this->loadAll(TaskWebhook::class, 'webhooks', [ |
361 | 361 | 'workspace' => $this->getWorkspace()->getGid(), |
362 | 362 | 'resource' => $this->getGid() |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | /** |
367 | 367 | * @return bool |
368 | 368 | */ |
369 | - public function isRenderedAsSeparator (): bool { |
|
369 | + public function isRenderedAsSeparator(): bool { |
|
370 | 370 | return $this->_is('is_rendered_as_separator'); |
371 | 371 | } |
372 | 372 | |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | * @after-create |
377 | 377 | * @return Story |
378 | 378 | */ |
379 | - public function newComment () { |
|
379 | + public function newComment() { |
|
380 | 380 | /** @var Story $comment */ |
381 | 381 | $comment = $this->factory(Story::class, [ |
382 | 382 | 'resource_subtype' => Story::TYPE_COMMENT_ADDED |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | * @after-create |
391 | 391 | * @return Task |
392 | 392 | */ |
393 | - public function newSubTask () { |
|
393 | + public function newSubTask() { |
|
394 | 394 | /** @var Task $sub */ |
395 | 395 | $sub = $this->factory(self::class); |
396 | 396 | return $sub->setParent($this); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | * @param Task[] $tasks |
404 | 404 | * @return $this |
405 | 405 | */ |
406 | - public function removeDependencies (array $tasks) { |
|
406 | + public function removeDependencies(array $tasks) { |
|
407 | 407 | $this->api->post("{$this}/removeDependencies", ['dependencies' => static::_getGids($tasks)]); |
408 | 408 | return $this; |
409 | 409 | } |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | * @param Task $task |
416 | 416 | * @return $this |
417 | 417 | */ |
418 | - public function removeDependency (Task $task) { |
|
418 | + public function removeDependency(Task $task) { |
|
419 | 419 | return $this->removeDependencies([$task]); |
420 | 420 | } |
421 | 421 | |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | * @param Task $task |
427 | 427 | * @return $this |
428 | 428 | */ |
429 | - public function removeDependent (Task $task) { |
|
429 | + public function removeDependent(Task $task) { |
|
430 | 430 | return $this->removeDependents([$task]); |
431 | 431 | } |
432 | 432 | |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * @param Task[] $tasks |
438 | 438 | * @return $this |
439 | 439 | */ |
440 | - public function removeDependents (array $tasks) { |
|
440 | + public function removeDependents(array $tasks) { |
|
441 | 441 | $this->api->post("{$this}/removeDependents", ['dependents' => static::_getGids($tasks)]); |
442 | 442 | return $this; |
443 | 443 | } |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | * @param User $user |
449 | 449 | * @return $this |
450 | 450 | */ |
451 | - public function removeFollower (User $user) { |
|
451 | + public function removeFollower(User $user) { |
|
452 | 452 | return $this->removeFollowers([$user]); |
453 | 453 | } |
454 | 454 | |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | * @param User[] $users |
459 | 459 | * @return $this |
460 | 460 | */ |
461 | - public function removeFollowers (array $users) { |
|
461 | + public function removeFollowers(array $users) { |
|
462 | 462 | if ($this->hasGid()) { |
463 | 463 | $this->api->post("{$this}/removeFollowers", ['followers' => static::_getGids($users)]); |
464 | 464 | } |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * @param Project $project |
473 | 473 | * @return $this |
474 | 474 | */ |
475 | - public function removeFromProject (Project $project) { |
|
475 | + public function removeFromProject(Project $project) { |
|
476 | 476 | $gid = $project->getGid(); |
477 | 477 | if ($this->hasGid()) { |
478 | 478 | $this->api->post("{$this}/removeProject", ['project' => $gid]); |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | * @param Tag $tag |
492 | 492 | * @return $this |
493 | 493 | */ |
494 | - public function removeTag (Tag $tag) { |
|
494 | + public function removeTag(Tag $tag) { |
|
495 | 495 | if ($this->hasGid()) { |
496 | 496 | $this->api->post("{$this}/removeTag", ['tag' => $tag->getGid()]); |
497 | 497 | } |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | * @param null|Task $parent |
506 | 506 | * @return $this |
507 | 507 | */ |
508 | - public function setParent (?self $parent) { |
|
508 | + public function setParent(?self $parent) { |
|
509 | 509 | if ($this->hasGid()) { |
510 | 510 | $this->api->post("{$this}/setParent", ['parent' => $parent ? $parent->getGid() : null]); |
511 | 511 | $this->data['parent'] = $parent; |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | * @param bool $flag |
521 | 521 | * @return $this |
522 | 522 | */ |
523 | - public function setRenderedAsSeparator (bool $flag) { |
|
523 | + public function setRenderedAsSeparator(bool $flag) { |
|
524 | 524 | return $this->_set('is_rendered_as_separator', $flag); |
525 | 525 | } |
526 | 526 | } |
527 | 527 | \ No newline at end of file |
@@ -179,8 +179,7 @@ discard block |
||
179 | 179 | if ($this->hasGid()) { |
180 | 180 | $this->api->post("{$this}/addFollowers", ['followers' => static::_getGids($users)]); |
181 | 181 | $this->_merge('followers', $users); |
182 | - } |
|
183 | - else { |
|
182 | + } else { |
|
184 | 183 | $this->_merge('followers', $users, true); |
185 | 184 | } |
186 | 185 | return $this; |
@@ -196,8 +195,7 @@ discard block |
||
196 | 195 | if ($this->hasGid()) { |
197 | 196 | $this->api->post("{$this}/addTag", ['tag' => $tag->getGid()]); |
198 | 197 | $this->_merge('tags', [$tag]); |
199 | - } |
|
200 | - else { |
|
198 | + } else { |
|
201 | 199 | $this->_merge('tags', [$tag], true); |
202 | 200 | } |
203 | 201 | return $this; |
@@ -222,8 +220,7 @@ discard block |
||
222 | 220 | 'section' => $section |
223 | 221 | ]); |
224 | 222 | } |
225 | - } |
|
226 | - else { |
|
223 | + } else { |
|
227 | 224 | if (!$this->hasWorkspace()) { |
228 | 225 | $this->setWorkspace($project->getWorkspace()); |
229 | 226 | } |
@@ -509,8 +506,7 @@ discard block |
||
509 | 506 | if ($this->hasGid()) { |
510 | 507 | $this->api->post("{$this}/setParent", ['parent' => $parent ? $parent->getGid() : null]); |
511 | 508 | $this->data['parent'] = $parent; |
512 | - } |
|
513 | - else { |
|
509 | + } else { |
|
514 | 510 | $this->_set('parent', $parent); |
515 | 511 | } |
516 | 512 | return $this; |
@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | class Like extends Data { |
14 | 14 | |
15 | - public function _getMap (): array { |
|
15 | + public function _getMap(): array { |
|
16 | 16 | return [ |
17 | 17 | 'user' => User::class |
18 | 18 | ]; |
@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | class Membership extends Data { |
18 | 18 | |
19 | - protected function _getMap (): array { |
|
19 | + protected function _getMap(): array { |
|
20 | 20 | return [ |
21 | 21 | 'project' => Project::class, |
22 | 22 | 'section' => Section::class |