@@ -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; |
@@ -39,15 +39,15 @@ discard block |
||
39 | 39 | const TYPE_NUMBER = 'number'; |
40 | 40 | const TYPE_TEXT = 'text'; |
41 | 41 | |
42 | - final public function __toString (): string { |
|
42 | + final public function __toString(): string { |
|
43 | 43 | return "custom_fields/{$this->getGid()}"; |
44 | 44 | } |
45 | 45 | |
46 | - final protected function _getDir (): string { |
|
46 | + final protected function _getDir(): string { |
|
47 | 47 | return 'custom_fields'; |
48 | 48 | } |
49 | 49 | |
50 | - protected function _getMap (): array { |
|
50 | + protected function _getMap(): array { |
|
51 | 51 | return [ |
52 | 52 | 'enum_options' => [EnumOption::class], |
53 | 53 | ]; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param string $name |
58 | 58 | * @return EnumOption |
59 | 59 | */ |
60 | - public function addEnumOption (string $name) { |
|
60 | + public function addEnumOption(string $name) { |
|
61 | 61 | /** @var EnumOption $option */ |
62 | 62 | $option = $this->factory(EnumOption::class); |
63 | 63 | $option->setName($name); |
@@ -74,28 +74,28 @@ discard block |
||
74 | 74 | /** |
75 | 75 | * @return bool |
76 | 76 | */ |
77 | - public function hasNotificationsEnabled (): bool { |
|
77 | + public function hasNotificationsEnabled(): bool { |
|
78 | 78 | return $this->_is('has_notifications_enabled'); |
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
82 | 82 | * @return bool |
83 | 83 | */ |
84 | - public function isEnum (): bool { |
|
84 | + public function isEnum(): bool { |
|
85 | 85 | return $this->getResourceSubtype() === self::TYPE_ENUM; |
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | 89 | * @return bool |
90 | 90 | */ |
91 | - public function isGlobalToWorkspace (): bool { |
|
91 | + public function isGlobalToWorkspace(): bool { |
|
92 | 92 | return $this->_is('is_global_to_workspace'); |
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
96 | 96 | * @return bool |
97 | 97 | */ |
98 | - final public function isText (): bool { |
|
98 | + final public function isText(): bool { |
|
99 | 99 | return $this->getResourceSubtype() === self::TYPE_TEXT; |
100 | 100 | } |
101 | 101 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param bool $flag |
104 | 104 | * @return $this |
105 | 105 | */ |
106 | - public function setGlobalToWorkspace (bool $flag) { |
|
106 | + public function setGlobalToWorkspace(bool $flag) { |
|
107 | 107 | return $this->_set('is_global_to_workspace', $flag); |
108 | 108 | } |
109 | 109 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @param bool $flag |
112 | 112 | * @return $this |
113 | 113 | */ |
114 | - public function setNotificationsEnabled (bool $flag) { |
|
114 | + public function setNotificationsEnabled(bool $flag) { |
|
115 | 115 | return $this->_set('has_notifications_enabled', $flag); |
116 | 116 | } |
117 | 117 |
@@ -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 | } |
@@ -52,24 +52,24 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * @return Cache |
54 | 54 | */ |
55 | - public static function getCache () { |
|
55 | + public static function getCache() { |
|
56 | 56 | return static::$cache ?? static::$cache = new Cache(); |
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | 60 | * @return Api |
61 | 61 | */ |
62 | - public static function getDefault () { |
|
62 | + public static function getDefault() { |
|
63 | 63 | return self::$default; |
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
67 | 67 | * @return LoggerInterface |
68 | 68 | */ |
69 | - public static function getLogger () { |
|
69 | + public static function getLogger() { |
|
70 | 70 | return static::$logger ?? static::$logger = new class implements LoggerInterface { |
71 | 71 | |
72 | - public function log (string $info, string $path, ?array $payload): void { |
|
72 | + public function log(string $info, string $path, ?array $payload): void { |
|
73 | 73 | // stub |
74 | 74 | } |
75 | 75 | |
@@ -79,28 +79,28 @@ discard block |
||
79 | 79 | /** |
80 | 80 | * @param Cache $cache |
81 | 81 | */ |
82 | - public static function setCache (Cache $cache) { |
|
82 | + public static function setCache(Cache $cache) { |
|
83 | 83 | static::$cache = $cache; |
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
87 | 87 | * @param Api $default |
88 | 88 | */ |
89 | - public static function setDefault (Api $default) { |
|
89 | + public static function setDefault(Api $default) { |
|
90 | 90 | self::$default = $default; |
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
94 | 94 | * @param LoggerInterface $logger |
95 | 95 | */ |
96 | - public static function setLogger (LoggerInterface $logger) { |
|
96 | + public static function setLogger(LoggerInterface $logger) { |
|
97 | 97 | static::$logger = $logger; |
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
101 | 101 | * @param string $token |
102 | 102 | */ |
103 | - public function __construct (string $token) { |
|
103 | + public function __construct(string $token) { |
|
104 | 104 | $this->token = $token; |
105 | 105 | if (!static::$default) { |
106 | 106 | static::$default = $this; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @param string $path |
114 | 114 | */ |
115 | - public function delete (string $path): void { |
|
115 | + public function delete(string $path): void { |
|
116 | 116 | $this->exec('DELETE', $path); |
117 | 117 | } |
118 | 118 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @return null|array |
124 | 124 | * @internal |
125 | 125 | */ |
126 | - protected function exec (string $method, string $path, array $opts = null) { |
|
126 | + protected function exec(string $method, string $path, array $opts = null) { |
|
127 | 127 | $ch = curl_init(); |
128 | 128 | curl_setopt_array($ch, [ |
129 | 129 | CURLOPT_CUSTOMREQUEST => $method, |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param array $data |
175 | 175 | * @return mixed |
176 | 176 | */ |
177 | - public function factory (string $class, $caller, array $data = []) { |
|
177 | + public function factory(string $class, $caller, array $data = []) { |
|
178 | 178 | return new $class($caller, $data); |
179 | 179 | } |
180 | 180 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @param array $options |
187 | 187 | * @return null|array |
188 | 188 | */ |
189 | - public function get (string $path, array $query = [], array $options = []) { |
|
189 | + public function get(string $path, array $query = [], array $options = []) { |
|
190 | 190 | foreach ($options as $name => $value) { |
191 | 191 | $query["opt_{$name}"] = $value; |
192 | 192 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @param string $gid |
201 | 201 | * @return null|Attachment |
202 | 202 | */ |
203 | - public function getAttachment (string $gid) { |
|
203 | + public function getAttachment(string $gid) { |
|
204 | 204 | return $this->load(Attachment::class, $this, "attachments/{$gid}"); |
205 | 205 | } |
206 | 206 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @param string $gid |
211 | 211 | * @return null|CustomField |
212 | 212 | */ |
213 | - public function getCustomField (string $gid) { |
|
213 | + public function getCustomField(string $gid) { |
|
214 | 214 | return $this->load(CustomField::class, $this, "custom_fields/{$gid}"); |
215 | 215 | } |
216 | 216 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * |
220 | 220 | * @return User |
221 | 221 | */ |
222 | - public function getMe () { |
|
222 | + public function getMe() { |
|
223 | 223 | return $this->getUser('me'); |
224 | 224 | } |
225 | 225 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @param array $query |
231 | 231 | * @return string |
232 | 232 | */ |
233 | - protected function getPath (string $path, array $query): string { |
|
233 | + protected function getPath(string $path, array $query): string { |
|
234 | 234 | return $query ? $path . '?' . http_build_query($query) : $path; |
235 | 235 | } |
236 | 236 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * @param string $gid |
241 | 241 | * @return null|Portfolio |
242 | 242 | */ |
243 | - public function getPortfolio (string $gid) { |
|
243 | + public function getPortfolio(string $gid) { |
|
244 | 244 | return $this->load(Portfolio::class, $this, "portfolios/{$gid}"); |
245 | 245 | } |
246 | 246 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | * @param string $gid |
251 | 251 | * @return null|Project |
252 | 252 | */ |
253 | - public function getProject (string $gid) { |
|
253 | + public function getProject(string $gid) { |
|
254 | 254 | return $this->load(Project::class, $this, "projects/{$gid}"); |
255 | 255 | } |
256 | 256 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @param string $gid |
261 | 261 | * @return null|Section |
262 | 262 | */ |
263 | - public function getSection (string $gid) { |
|
263 | + public function getSection(string $gid) { |
|
264 | 264 | return $this->load(Section::class, $this, "sections/{$gid}"); |
265 | 265 | } |
266 | 266 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @param string $gid |
271 | 271 | * @return null|Story |
272 | 272 | */ |
273 | - public function getStory (string $gid) { |
|
273 | + public function getStory(string $gid) { |
|
274 | 274 | return $this->load(Story::class, $this, "stories/{$gid}"); |
275 | 275 | } |
276 | 276 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @param string $gid |
281 | 281 | * @return null|Tag |
282 | 282 | */ |
283 | - public function getTag (string $gid) { |
|
283 | + public function getTag(string $gid) { |
|
284 | 284 | return $this->load(Tag::class, $this, "tags/{$gid}"); |
285 | 285 | } |
286 | 286 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * @param string $gid |
291 | 291 | * @return null|Task |
292 | 292 | */ |
293 | - public function getTask (string $gid) { |
|
293 | + public function getTask(string $gid) { |
|
294 | 294 | return $this->load(Task::class, $this, "tasks/{$gid}"); |
295 | 295 | } |
296 | 296 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @param string $gid |
301 | 301 | * @return null|Team |
302 | 302 | */ |
303 | - public function getTeam (string $gid) { |
|
303 | + public function getTeam(string $gid) { |
|
304 | 304 | return $this->load(Team::class, $this, "teams/{$gid}"); |
305 | 305 | } |
306 | 306 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * @param string $gid |
311 | 311 | * @return null|User |
312 | 312 | */ |
313 | - public function getUser (string $gid) { |
|
313 | + public function getUser(string $gid) { |
|
314 | 314 | return $this->load(User::class, $this, "users/{$gid}"); |
315 | 315 | } |
316 | 316 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * @param array $data |
323 | 323 | * @return ProjectEvent|TaskEvent|StoryEvent |
324 | 324 | */ |
325 | - public function getWebhookEvent (array $data) { |
|
325 | + public function getWebhookEvent(array $data) { |
|
326 | 326 | static $classes = [ |
327 | 327 | Project::TYPE => ProjectEvent::class, |
328 | 328 | Task::TYPE => TaskEvent::class, |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | * @param string $gid |
336 | 336 | * @return null|Workspace |
337 | 337 | */ |
338 | - public function getWorkspace (string $gid) { |
|
338 | + public function getWorkspace(string $gid) { |
|
339 | 339 | return $this->load(Workspace::class, $this, "workspaces/{$gid}"); |
340 | 340 | } |
341 | 341 | |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | * @param string $name |
344 | 344 | * @return null|Workspace |
345 | 345 | */ |
346 | - public function getWorkspaceByName (string $name) { |
|
346 | + public function getWorkspaceByName(string $name) { |
|
347 | 347 | foreach ($this->getMe()->getWorkspaces() as $workspace) { |
348 | 348 | if ($workspace->getName() === $name) { |
349 | 349 | return $workspace; |
@@ -356,16 +356,16 @@ discard block |
||
356 | 356 | * @param string $json |
357 | 357 | * @return null|array |
358 | 358 | */ |
359 | - protected function jsonDecode (string $json) { |
|
360 | - return json_decode($json, true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR); |
|
359 | + protected function jsonDecode(string $json) { |
|
360 | + return json_decode($json, true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
364 | 364 | * @param array $data |
365 | 365 | * @return string |
366 | 366 | */ |
367 | - protected function jsonEncode (array $data): string { |
|
368 | - return json_encode($data, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR); |
|
367 | + protected function jsonEncode(array $data): string { |
|
368 | + return json_encode($data, JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | * @param array $query |
380 | 380 | * @return null|mixed|AbstractEntity |
381 | 381 | */ |
382 | - public function load (string $class, $caller, string $path, array $query = []) { |
|
382 | + public function load(string $class, $caller, string $path, array $query = []) { |
|
383 | 383 | $key = $this->getPath($path, $query); |
384 | 384 | return $this->getCache()->get($key, $caller, function($caller) use ($class, $path, $query) { |
385 | 385 | $data = $this->get($path, $query, ['expand' => 'this']); |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | * @param int $pages If positive, stops after this many pages have been fetched. |
400 | 400 | * @return array|AbstractEntity[] |
401 | 401 | */ |
402 | - public function loadAll (string $class, $caller, string $path, array $query = [], int $pages = 0) { |
|
402 | + public function loadAll(string $class, $caller, string $path, array $query = [], int $pages = 0) { |
|
403 | 403 | $query['opt_expand'] = 'this'; |
404 | 404 | $query += ['limit' => 100]; |
405 | 405 | $path = $this->getPath($path, $query); |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | * @param array $options |
426 | 426 | * @return null|array |
427 | 427 | */ |
428 | - public function post (string $path, array $data = [], array $options = []) { |
|
428 | + public function post(string $path, array $data = [], array $options = []) { |
|
429 | 429 | $response = $this->exec('POST', $path, [ |
430 | 430 | CURLOPT_HTTPHEADER => ['Content-Type: application/json'], |
431 | 431 | CURLOPT_POSTFIELDS => $this->jsonEncode(['options' => $options, 'data' => $data]) |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | * @param array $options |
442 | 442 | * @return null|array |
443 | 443 | */ |
444 | - public function put (string $path, array $data = [], array $options = []) { |
|
444 | + public function put(string $path, array $data = [], array $options = []) { |
|
445 | 445 | $response = $this->exec('PUT', $path, [ |
446 | 446 | CURLOPT_HTTPHEADER => ['Content-Type: application/json'], |
447 | 447 | CURLOPT_POSTFIELDS => $this->jsonEncode(['options' => $options, 'data' => $data]) |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * @param null|string $token |
461 | 461 | * @return ProjectEvent[]|TaskEvent[]|StoryEvent[] |
462 | 462 | */ |
463 | - public function sync ($entity, &$token) { |
|
463 | + public function sync($entity, &$token) { |
|
464 | 464 | try { |
465 | 465 | $response = $this->exec('GET', $this->getPath('events', [ |
466 | 466 | 'resource' => $entity->getGid(), |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | * @param string $file |
493 | 493 | * @return null|array |
494 | 494 | */ |
495 | - public function upload (string $path, string $file) { |
|
495 | + public function upload(string $path, string $file) { |
|
496 | 496 | $response = $this->exec('POST', $path, [ |
497 | 497 | CURLOPT_POSTFIELDS => ['file' => new CURLFile(realpath($file))] // multipart/form-data |
498 | 498 | ]); |
@@ -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 |
@@ -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; |
@@ -74,15 +74,15 @@ discard block |
||
74 | 74 | const ASSIGN_TODAY = 'today'; |
75 | 75 | const ASSIGN_UPCOMING = 'upcoming'; |
76 | 76 | |
77 | - final public function __toString (): string { |
|
77 | + final public function __toString(): string { |
|
78 | 78 | return "tasks/{$this->getGid()}"; |
79 | 79 | } |
80 | 80 | |
81 | - final protected function _getDir (): string { |
|
81 | + final protected function _getDir(): string { |
|
82 | 82 | return 'tasks'; |
83 | 83 | } |
84 | 84 | |
85 | - protected function _getMap (): array { |
|
85 | + protected function _getMap(): array { |
|
86 | 86 | return [ |
87 | 87 | 'assignee' => User::class, |
88 | 88 | 'custom_fields' => CustomValues::class, |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param string $file |
104 | 104 | * @return Attachment |
105 | 105 | */ |
106 | - public function addAttachment (string $file) { |
|
106 | + public function addAttachment(string $file) { |
|
107 | 107 | /** @var Attachment $attachment */ |
108 | 108 | $attachment = $this->factory(Attachment::class, ['parent' => $this]); |
109 | 109 | return $attachment->upload($file); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param string $text |
117 | 117 | * @return Story |
118 | 118 | */ |
119 | - public function addComment (string $text) { |
|
119 | + public function addComment(string $text) { |
|
120 | 120 | return $this->newComment()->setText($text)->create(); |
121 | 121 | } |
122 | 122 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @param Task[] $tasks |
128 | 128 | * @return $this |
129 | 129 | */ |
130 | - public function addDependencies (array $tasks) { |
|
130 | + public function addDependencies(array $tasks) { |
|
131 | 131 | $this->api->post("{$this}/addDependencies", ['dependents' => static::_getGids($tasks)]); |
132 | 132 | return $this; |
133 | 133 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @param Task $task |
140 | 140 | * @return $this |
141 | 141 | */ |
142 | - public function addDependency (Task $task) { |
|
142 | + public function addDependency(Task $task) { |
|
143 | 143 | return $this->addDependencies([$task]); |
144 | 144 | } |
145 | 145 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @param Task $task |
151 | 151 | * @return $this |
152 | 152 | */ |
153 | - public function addDependent (Task $task) { |
|
153 | + public function addDependent(Task $task) { |
|
154 | 154 | return $this->addDependents([$task]); |
155 | 155 | } |
156 | 156 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @param Task[] $tasks |
162 | 162 | * @return $this |
163 | 163 | */ |
164 | - public function addDependents (array $tasks) { |
|
164 | + public function addDependents(array $tasks) { |
|
165 | 165 | $this->api->post("{$this}/addDependents", ['dependents' => static::_getGids($tasks)]); |
166 | 166 | return $this; |
167 | 167 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @param User $user |
173 | 173 | * @return $this |
174 | 174 | */ |
175 | - public function addFollower (User $user) { |
|
175 | + public function addFollower(User $user) { |
|
176 | 176 | return $this->addFollowers([$user]); |
177 | 177 | } |
178 | 178 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @param User[] $users |
183 | 183 | * @return $this |
184 | 184 | */ |
185 | - public function addFollowers (array $users) { |
|
185 | + public function addFollowers(array $users) { |
|
186 | 186 | if ($this->hasGid()) { |
187 | 187 | $this->api->post("{$this}/addFollowers", ['followers' => static::_getGids($users)]); |
188 | 188 | $this->_merge('followers', $users); |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @param Tag $tag |
200 | 200 | * @return $this |
201 | 201 | */ |
202 | - public function addTag (Tag $tag) { |
|
202 | + public function addTag(Tag $tag) { |
|
203 | 203 | if ($this->hasGid()) { |
204 | 204 | $this->api->post("{$this}/addTag", ['tag' => $tag->getGid()]); |
205 | 205 | $this->_merge('tags', [$tag]); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @param Section $section |
217 | 217 | * @return $this |
218 | 218 | */ |
219 | - public function addToProject (Section $section) { |
|
219 | + public function addToProject(Section $section) { |
|
220 | 220 | $project = $section->getProject(); |
221 | 221 | if ($this->hasGid()) { |
222 | 222 | $this->api->post("{$this}/addProject", [ |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | * @param string $target |
251 | 251 | * @return TaskWebhook |
252 | 252 | */ |
253 | - public function addWebhook (string $target) { |
|
253 | + public function addWebhook(string $target) { |
|
254 | 254 | /** @var TaskWebhook $webhook */ |
255 | 255 | $webhook = $this->factory(TaskWebhook::class); |
256 | 256 | return $webhook->create($this, $target); |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | * @param string[] $include |
267 | 267 | * @return Job |
268 | 268 | */ |
269 | - public function duplicate (string $name, array $include) { |
|
269 | + public function duplicate(string $name, array $include) { |
|
270 | 270 | $remote = $this->api->post("{$this}/duplicate", [ |
271 | 271 | 'name' => $name, |
272 | 272 | 'include' => array_values($include) |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @depends after-create |
281 | 281 | * @return Attachment[] |
282 | 282 | */ |
283 | - public function getAttachments () { |
|
283 | + public function getAttachments() { |
|
284 | 284 | return $this->loadAll(Attachment::class, "{$this}/attachments"); |
285 | 285 | } |
286 | 286 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * @depends after-create |
291 | 291 | * @return Story[] |
292 | 292 | */ |
293 | - public function getComments () { |
|
293 | + public function getComments() { |
|
294 | 294 | return array_values(array_filter($this->getStories(), function(Story $story) { |
295 | 295 | return $story->isComment(); |
296 | 296 | })); |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | * @depends after-create |
303 | 303 | * @return Task[] |
304 | 304 | */ |
305 | - public function getDependencies () { |
|
305 | + public function getDependencies() { |
|
306 | 306 | return $this->loadAll(self::class, "{$this}/dependencies"); |
307 | 307 | } |
308 | 308 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * @depends after-create |
313 | 313 | * @return Task[] |
314 | 314 | */ |
315 | - public function getDependents () { |
|
315 | + public function getDependents() { |
|
316 | 316 | return $this->loadAll(self::class, "{$this}/dependents"); |
317 | 317 | } |
318 | 318 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * @param null|string $token |
324 | 324 | * @return TaskEvent[]|StoryEvent[] |
325 | 325 | */ |
326 | - public function getEvents (&$token) { |
|
326 | + public function getEvents(&$token) { |
|
327 | 327 | return $this->api->sync($this, $token); |
328 | 328 | } |
329 | 329 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * @depends after-create |
334 | 334 | * @return Story[] |
335 | 335 | */ |
336 | - public function getStories () { |
|
336 | + public function getStories() { |
|
337 | 337 | return $this->loadAll(Story::class, "{$this}/stories"); |
338 | 338 | } |
339 | 339 | |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | * @depends after-create |
344 | 344 | * @return Task[] |
345 | 345 | */ |
346 | - public function getSubTasks () { |
|
346 | + public function getSubTasks() { |
|
347 | 347 | return $this->loadAll(self::class, "{$this}/subtasks"); |
348 | 348 | } |
349 | 349 | |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | * @depends after-create |
354 | 354 | * @return string |
355 | 355 | */ |
356 | - public function getUrl (): string { |
|
356 | + public function getUrl(): string { |
|
357 | 357 | return "https://app.asana.com/0/0/{$this->getGid()}"; |
358 | 358 | } |
359 | 359 | |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | * @depends after-create |
364 | 364 | * @return TaskWebhook[] |
365 | 365 | */ |
366 | - public function getWebhooks () { |
|
366 | + public function getWebhooks() { |
|
367 | 367 | return $this->loadAll(TaskWebhook::class, 'webhooks', [ |
368 | 368 | 'workspace' => $this->getWorkspace()->getGid(), |
369 | 369 | 'resource' => $this->getGid() |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | /** |
374 | 374 | * @return bool |
375 | 375 | */ |
376 | - public function isRenderedAsSeparator (): bool { |
|
376 | + public function isRenderedAsSeparator(): bool { |
|
377 | 377 | return $this->_is('is_rendered_as_separator'); |
378 | 378 | } |
379 | 379 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | * @depends after-create |
384 | 384 | * @return Story |
385 | 385 | */ |
386 | - public function newComment () { |
|
386 | + public function newComment() { |
|
387 | 387 | /** @var Story $comment */ |
388 | 388 | $comment = $this->factory(Story::class, [ |
389 | 389 | 'resource_subtype' => Story::TYPE_COMMENT_ADDED |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | * @depends after-create |
398 | 398 | * @return Task |
399 | 399 | */ |
400 | - public function newSubTask () { |
|
400 | + public function newSubTask() { |
|
401 | 401 | /** @var Task $sub */ |
402 | 402 | $sub = $this->factory(self::class); |
403 | 403 | return $sub->setParent($this); |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * @param Task[] $tasks |
411 | 411 | * @return $this |
412 | 412 | */ |
413 | - public function removeDependencies (array $tasks) { |
|
413 | + public function removeDependencies(array $tasks) { |
|
414 | 414 | $this->api->post("{$this}/removeDependencies", ['dependencies' => static::_getGids($tasks)]); |
415 | 415 | return $this; |
416 | 416 | } |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * @param Task $task |
423 | 423 | * @return $this |
424 | 424 | */ |
425 | - public function removeDependency (Task $task) { |
|
425 | + public function removeDependency(Task $task) { |
|
426 | 426 | return $this->removeDependencies([$task]); |
427 | 427 | } |
428 | 428 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * @param Task $task |
434 | 434 | * @return $this |
435 | 435 | */ |
436 | - public function removeDependent (Task $task) { |
|
436 | + public function removeDependent(Task $task) { |
|
437 | 437 | return $this->removeDependents([$task]); |
438 | 438 | } |
439 | 439 | |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * @param Task[] $tasks |
445 | 445 | * @return $this |
446 | 446 | */ |
447 | - public function removeDependents (array $tasks) { |
|
447 | + public function removeDependents(array $tasks) { |
|
448 | 448 | $this->api->post("{$this}/removeDependents", ['dependents' => static::_getGids($tasks)]); |
449 | 449 | return $this; |
450 | 450 | } |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | * @param User $user |
456 | 456 | * @return $this |
457 | 457 | */ |
458 | - public function removeFollower (User $user) { |
|
458 | + public function removeFollower(User $user) { |
|
459 | 459 | return $this->removeFollowers([$user]); |
460 | 460 | } |
461 | 461 | |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | * @param User[] $users |
466 | 466 | * @return $this |
467 | 467 | */ |
468 | - public function removeFollowers (array $users) { |
|
468 | + public function removeFollowers(array $users) { |
|
469 | 469 | if ($this->hasGid()) { |
470 | 470 | $this->api->post("{$this}/removeFollowers", ['followers' => static::_getGids($users)]); |
471 | 471 | } |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * @param Project $project |
480 | 480 | * @return $this |
481 | 481 | */ |
482 | - public function removeFromProject (Project $project) { |
|
482 | + public function removeFromProject(Project $project) { |
|
483 | 483 | $gid = $project->getGid(); |
484 | 484 | if ($this->hasGid()) { |
485 | 485 | $this->api->post("{$this}/removeProject", ['project' => $gid]); |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | * @param Tag $tag |
499 | 499 | * @return $this |
500 | 500 | */ |
501 | - public function removeTag (Tag $tag) { |
|
501 | + public function removeTag(Tag $tag) { |
|
502 | 502 | if ($this->hasGid()) { |
503 | 503 | $this->api->post("{$this}/removeTag", ['tag' => $tag->getGid()]); |
504 | 504 | } |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | * @param null|Task $parent |
513 | 513 | * @return $this |
514 | 514 | */ |
515 | - public function setParent (?self $parent) { |
|
515 | + public function setParent(?self $parent) { |
|
516 | 516 | if ($this->hasGid()) { |
517 | 517 | $this->api->post("{$this}/setParent", ['parent' => $parent ? $parent->getGid() : null]); |
518 | 518 | $this->data['parent'] = $parent; |
@@ -527,14 +527,14 @@ discard block |
||
527 | 527 | * @param bool $flag |
528 | 528 | * @return $this |
529 | 529 | */ |
530 | - public function setRenderedAsSeparator (bool $flag) { |
|
530 | + public function setRenderedAsSeparator(bool $flag) { |
|
531 | 531 | return $this->_set('is_rendered_as_separator', $flag); |
532 | 532 | } |
533 | 533 | |
534 | 534 | /** |
535 | 535 | * @return $this |
536 | 536 | */ |
537 | - public function update () { |
|
537 | + public function update() { |
|
538 | 538 | $this->_update(); |
539 | 539 | if ($this->hasCustomFields()) { |
540 | 540 | $this->getCustomFields()->diff = []; |
@@ -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 |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | |
29 | 29 | const TYPE = 'attachment'; |
30 | 30 | |
31 | - final public function __toString (): string { |
|
31 | + final public function __toString(): string { |
|
32 | 32 | return "attachments/{$this->getGid()}"; |
33 | 33 | } |
34 | 34 | |
35 | - protected function _getMap (): array { |
|
35 | + protected function _getMap(): array { |
|
36 | 36 | return [ |
37 | 37 | 'parent' => Task::class |
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 | $remote = $this->api->upload("{$this->getParent()}/attachments", $file); |
50 | 50 | $this->data['gid'] = $remote['gid']; |
@@ -39,15 +39,15 @@ discard block |
||
39 | 39 | const TYPE_LIKED = 'liked'; |
40 | 40 | const TYPE_TAGGED = 'added_to_tag'; |
41 | 41 | |
42 | - final public function __toString (): string { |
|
42 | + final public function __toString(): string { |
|
43 | 43 | return "stories/{$this->getGid()}"; |
44 | 44 | } |
45 | 45 | |
46 | - final protected function _getDir (): string { |
|
46 | + final protected function _getDir(): string { |
|
47 | 47 | return "{$this->getTask()}/stories"; |
48 | 48 | } |
49 | 49 | |
50 | - protected function _getMap (): array { |
|
50 | + protected function _getMap(): array { |
|
51 | 51 | return [ |
52 | 52 | 'created_by' => User::class, |
53 | 53 | 'likes' => [User::class], |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | ]; |
56 | 56 | } |
57 | 57 | |
58 | - final public function isComment (): bool { |
|
58 | + final public function isComment(): bool { |
|
59 | 59 | return $this->getResourceSubtype() === self::TYPE_COMMENT_ADDED; |
60 | 60 | } |
61 | 61 | |
62 | - public function isEdited (): bool { |
|
62 | + public function isEdited(): bool { |
|
63 | 63 | return $this->_is('is_edited'); |
64 | 64 | } |
65 | 65 | |
66 | - public function isPinned (): bool { |
|
66 | + public function isPinned(): bool { |
|
67 | 67 | return $this->_is('is_pinned'); |
68 | 68 | } |
69 | 69 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @param bool $pinned |
72 | 72 | * @return $this |
73 | 73 | */ |
74 | - public function setPinned (bool $pinned) { |
|
74 | + public function setPinned(bool $pinned) { |
|
75 | 75 | return $this->_set('is_pinned', $pinned); |
76 | 76 | } |
77 | 77 |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | |
27 | 27 | const TYPE = 'tag'; |
28 | 28 | |
29 | - final public function __toString (): string { |
|
29 | + final public function __toString(): string { |
|
30 | 30 | return "tags/{$this->getGid()}"; |
31 | 31 | } |
32 | 32 | |
33 | - final protected function _getDir (): string { |
|
33 | + final protected function _getDir(): string { |
|
34 | 34 | return 'tags'; |
35 | 35 | } |
36 | 36 | |
37 | - protected function _getMap (): array { |
|
37 | + protected function _getMap(): array { |
|
38 | 38 | return [ |
39 | 39 | 'followers' => [User::class], |
40 | 40 | 'workspace' => Workspace::class |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | /** |
45 | 45 | * @return Task[] |
46 | 46 | */ |
47 | - public function getTasks () { |
|
47 | + public function getTasks() { |
|
48 | 48 | return $this->loadAll(Task::class, "{$this}/tasks"); |
49 | 49 | } |
50 | 50 | } |
51 | 51 | \ No newline at end of file |