@@ -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 | } |
@@ -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 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * @param array $data |
276 | 276 | * @return ProjectEvent|TaskEvent|StoryEvent |
277 | 277 | */ |
278 | - public function getWebhookEvent (array $data) { |
|
278 | + public function getWebhookEvent(array $data) { |
|
279 | 279 | static $classes = [ |
280 | 280 | Project::TYPE => ProjectEvent::class, |
281 | 281 | Task::TYPE => TaskEvent::class, |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * @param string $gid |
289 | 289 | * @return null|Workspace |
290 | 290 | */ |
291 | - public function getWorkspace (string $gid) { |
|
291 | + public function getWorkspace(string $gid) { |
|
292 | 292 | return $this->load(Workspace::class, $this, "workspaces/{$gid}"); |
293 | 293 | } |
294 | 294 | |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * @param string $name |
297 | 297 | * @return null|Workspace |
298 | 298 | */ |
299 | - public function getWorkspaceByName (string $name) { |
|
299 | + public function getWorkspaceByName(string $name) { |
|
300 | 300 | foreach ($this->getMe()->getWorkspaces() as $workspace) { |
301 | 301 | if ($workspace->getName() === $name) { |
302 | 302 | return $workspace; |
@@ -309,16 +309,16 @@ discard block |
||
309 | 309 | * @param string $json |
310 | 310 | * @return null|array |
311 | 311 | */ |
312 | - protected function jsonDecode (string $json) { |
|
313 | - return json_decode($json, true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR); |
|
312 | + protected function jsonDecode(string $json) { |
|
313 | + return json_decode($json, true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
317 | 317 | * @param array $data |
318 | 318 | * @return string |
319 | 319 | */ |
320 | - protected function jsonEncode (array $data): string { |
|
321 | - return json_encode($data, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR); |
|
320 | + protected function jsonEncode(array $data): string { |
|
321 | + return json_encode($data, JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | /** |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @param array $query |
333 | 333 | * @return null|mixed|AbstractEntity |
334 | 334 | */ |
335 | - public function load (string $class, $caller, string $path, array $query = []) { |
|
335 | + public function load(string $class, $caller, string $path, array $query = []) { |
|
336 | 336 | $key = $this->getPath($path, $query); |
337 | 337 | return $this->cache->get($key, $caller, function($caller) use ($class, $path, $query) { |
338 | 338 | $data = $this->get($path, $query, ['expand' => 'this']); |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | * @param int $pages If positive, stops after this many pages have been fetched. |
353 | 353 | * @return array|AbstractEntity[] |
354 | 354 | */ |
355 | - public function loadAll (string $class, $caller, string $path, array $query = [], int $pages = 0) { |
|
355 | + public function loadAll(string $class, $caller, string $path, array $query = [], int $pages = 0) { |
|
356 | 356 | $query['opt_expand'] = 'this'; |
357 | 357 | $query += ['limit' => 100]; |
358 | 358 | $path = $this->getPath($path, $query); |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | * @param array $options |
379 | 379 | * @return null|array |
380 | 380 | */ |
381 | - public function post (string $path, array $data = [], array $options = []) { |
|
381 | + public function post(string $path, array $data = [], array $options = []) { |
|
382 | 382 | $response = $this->exec('POST', $path, [ |
383 | 383 | CURLOPT_HTTPHEADER => ['Content-Type: application/json'], |
384 | 384 | CURLOPT_POSTFIELDS => $this->jsonEncode(['options' => $options, 'data' => $data]) |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | * @param array $options |
395 | 395 | * @return null|array |
396 | 396 | */ |
397 | - public function put (string $path, array $data = [], array $options = []) { |
|
397 | + public function put(string $path, array $data = [], array $options = []) { |
|
398 | 398 | $response = $this->exec('PUT', $path, [ |
399 | 399 | CURLOPT_HTTPHEADER => ['Content-Type: application/json'], |
400 | 400 | CURLOPT_POSTFIELDS => $this->jsonEncode(['options' => $options, 'data' => $data]) |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | * @param Cache $cache |
407 | 407 | * @return $this |
408 | 408 | */ |
409 | - public function setCache (Cache $cache) { |
|
409 | + public function setCache(Cache $cache) { |
|
410 | 410 | $this->cache = $cache; |
411 | 411 | return $this; |
412 | 412 | } |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | * @param LoggerInterface $logger |
416 | 416 | * @return $this |
417 | 417 | */ |
418 | - public function setLogger (LoggerInterface $logger) { |
|
418 | + public function setLogger(LoggerInterface $logger) { |
|
419 | 419 | $this->logger = $logger; |
420 | 420 | return $this; |
421 | 421 | } |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | * @param null|string $token |
432 | 432 | * @return ProjectEvent[]|TaskEvent[]|StoryEvent[] |
433 | 433 | */ |
434 | - public function sync ($entity, &$token) { |
|
434 | + public function sync($entity, &$token) { |
|
435 | 435 | try { |
436 | 436 | $response = $this->exec('GET', $this->getPath('events', [ |
437 | 437 | 'resource' => $entity->getGid(), |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | * @param string $file |
464 | 464 | * @return null|array |
465 | 465 | */ |
466 | - public function upload (string $path, string $file) { |
|
466 | + public function upload(string $path, string $file) { |
|
467 | 467 | $response = $this->exec('POST', $path, [ |
468 | 468 | CURLOPT_POSTFIELDS => ['file' => new CURLFile(realpath($file))] // multipart/form-data |
469 | 469 | ]); |
@@ -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; |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | const ASSIGN_TODAY = 'today'; |
72 | 72 | const ASSIGN_UPCOMING = 'upcoming'; |
73 | 73 | |
74 | - final public function __toString (): string { |
|
74 | + final public function __toString(): string { |
|
75 | 75 | return "tasks/{$this->getGid()}"; |
76 | 76 | } |
77 | 77 | |
78 | - final protected function _getDir (): string { |
|
78 | + final protected function _getDir(): string { |
|
79 | 79 | return 'tasks'; |
80 | 80 | } |
81 | 81 | |
82 | - protected function _getMap (): array { |
|
82 | + protected function _getMap(): array { |
|
83 | 83 | return [ |
84 | 84 | 'assignee' => User::class, |
85 | 85 | 'custom_fields' => CustomValues::class, |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @param string $file |
101 | 101 | * @return Attachment |
102 | 102 | */ |
103 | - public function addAttachment (string $file) { |
|
103 | + public function addAttachment(string $file) { |
|
104 | 104 | /** @var Attachment $attachment */ |
105 | 105 | $attachment = $this->factory(Attachment::class, ['parent' => $this]); |
106 | 106 | return $attachment->upload($file); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param string $text |
114 | 114 | * @return Story |
115 | 115 | */ |
116 | - public function addComment (string $text) { |
|
116 | + public function addComment(string $text) { |
|
117 | 117 | return $this->newComment()->setText($text)->create(); |
118 | 118 | } |
119 | 119 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param Task[] $tasks |
125 | 125 | * @return $this |
126 | 126 | */ |
127 | - public function addDependencies (array $tasks) { |
|
127 | + public function addDependencies(array $tasks) { |
|
128 | 128 | $this->api->post("{$this}/addDependencies", ['dependents' => static::_getGids($tasks)]); |
129 | 129 | return $this; |
130 | 130 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @param Task $task |
137 | 137 | * @return $this |
138 | 138 | */ |
139 | - public function addDependency (Task $task) { |
|
139 | + public function addDependency(Task $task) { |
|
140 | 140 | return $this->addDependencies([$task]); |
141 | 141 | } |
142 | 142 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @param Task $task |
148 | 148 | * @return $this |
149 | 149 | */ |
150 | - public function addDependent (Task $task) { |
|
150 | + public function addDependent(Task $task) { |
|
151 | 151 | return $this->addDependents([$task]); |
152 | 152 | } |
153 | 153 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @param Task[] $tasks |
159 | 159 | * @return $this |
160 | 160 | */ |
161 | - public function addDependents (array $tasks) { |
|
161 | + public function addDependents(array $tasks) { |
|
162 | 162 | $this->api->post("{$this}/addDependents", ['dependents' => static::_getGids($tasks)]); |
163 | 163 | return $this; |
164 | 164 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @param User $user |
170 | 170 | * @return $this |
171 | 171 | */ |
172 | - public function addFollower (User $user) { |
|
172 | + public function addFollower(User $user) { |
|
173 | 173 | return $this->addFollowers([$user]); |
174 | 174 | } |
175 | 175 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @param User[] $users |
180 | 180 | * @return $this |
181 | 181 | */ |
182 | - public function addFollowers (array $users) { |
|
182 | + public function addFollowers(array $users) { |
|
183 | 183 | if ($this->hasGid()) { |
184 | 184 | $this->api->post("{$this}/addFollowers", ['followers' => static::_getGids($users)]); |
185 | 185 | $this->_merge('followers', $users); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * @param Tag $tag |
197 | 197 | * @return $this |
198 | 198 | */ |
199 | - public function addTag (Tag $tag) { |
|
199 | + public function addTag(Tag $tag) { |
|
200 | 200 | if ($this->hasGid()) { |
201 | 201 | $this->api->post("{$this}/addTag", ['tag' => $tag->getGid()]); |
202 | 202 | $this->_merge('tags', [$tag]); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param Section $section |
214 | 214 | * @return $this |
215 | 215 | */ |
216 | - public function addToProject (Section $section) { |
|
216 | + public function addToProject(Section $section) { |
|
217 | 217 | $project = $section->getProject(); |
218 | 218 | if ($this->hasGid()) { |
219 | 219 | $this->api->post("{$this}/addProject", [ |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * @param string $target |
248 | 248 | * @return TaskWebhook |
249 | 249 | */ |
250 | - public function addWebhook (string $target) { |
|
250 | + public function addWebhook(string $target) { |
|
251 | 251 | /** @var TaskWebhook $webhook */ |
252 | 252 | $webhook = $this->factory(TaskWebhook::class); |
253 | 253 | return $webhook->create($this, $target); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * @param string[] $include |
264 | 264 | * @return Job |
265 | 265 | */ |
266 | - public function duplicate (string $name, array $include) { |
|
266 | + public function duplicate(string $name, array $include) { |
|
267 | 267 | $remote = $this->api->post("{$this}/duplicate", [ |
268 | 268 | 'name' => $name, |
269 | 269 | 'include' => array_values($include) |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @depends after-create |
278 | 278 | * @return Attachment[] |
279 | 279 | */ |
280 | - public function getAttachments () { |
|
280 | + public function getAttachments() { |
|
281 | 281 | return $this->loadAll(Attachment::class, "{$this}/attachments"); |
282 | 282 | } |
283 | 283 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * @depends after-create |
288 | 288 | * @return Story[] |
289 | 289 | */ |
290 | - public function getComments () { |
|
290 | + public function getComments() { |
|
291 | 291 | return array_values(array_filter($this->getStories(), function(Story $story) { |
292 | 292 | return $story->isComment(); |
293 | 293 | })); |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @depends after-create |
300 | 300 | * @return Task[] |
301 | 301 | */ |
302 | - public function getDependencies () { |
|
302 | + public function getDependencies() { |
|
303 | 303 | return $this->loadAll(self::class, "{$this}/dependencies"); |
304 | 304 | } |
305 | 305 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * @depends after-create |
310 | 310 | * @return Task[] |
311 | 311 | */ |
312 | - public function getDependents () { |
|
312 | + public function getDependents() { |
|
313 | 313 | return $this->loadAll(self::class, "{$this}/dependents"); |
314 | 314 | } |
315 | 315 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * @param null|string $token |
321 | 321 | * @return TaskEvent[]|StoryEvent[] |
322 | 322 | */ |
323 | - public function getEvents (&$token) { |
|
323 | + public function getEvents(&$token) { |
|
324 | 324 | return $this->api->sync($this, $token); |
325 | 325 | } |
326 | 326 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * @depends after-create |
331 | 331 | * @return Story[] |
332 | 332 | */ |
333 | - public function getStories () { |
|
333 | + public function getStories() { |
|
334 | 334 | return $this->loadAll(Story::class, "{$this}/stories"); |
335 | 335 | } |
336 | 336 | |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | * @depends after-create |
341 | 341 | * @return Task[] |
342 | 342 | */ |
343 | - public function getSubTasks () { |
|
343 | + public function getSubTasks() { |
|
344 | 344 | return $this->loadAll(self::class, "{$this}/subtasks"); |
345 | 345 | } |
346 | 346 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * @depends after-create |
351 | 351 | * @return string |
352 | 352 | */ |
353 | - public function getUrl (): string { |
|
353 | + public function getUrl(): string { |
|
354 | 354 | return "https://app.asana.com/0/0/{$this->getGid()}"; |
355 | 355 | } |
356 | 356 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * @depends after-create |
361 | 361 | * @return TaskWebhook[] |
362 | 362 | */ |
363 | - public function getWebhooks () { |
|
363 | + public function getWebhooks() { |
|
364 | 364 | return $this->loadAll(TaskWebhook::class, 'webhooks', [ |
365 | 365 | 'workspace' => $this->getWorkspace()->getGid(), |
366 | 366 | 'resource' => $this->getGid() |
@@ -372,14 +372,14 @@ discard block |
||
372 | 372 | * |
373 | 373 | * @return bool |
374 | 374 | */ |
375 | - public function isDiff (): bool { |
|
375 | + public function isDiff(): bool { |
|
376 | 376 | return parent::isDiff() or $this->hasCustomFields() && $this->getCustomFields()->isDiff(); |
377 | 377 | } |
378 | 378 | |
379 | 379 | /** |
380 | 380 | * @return bool |
381 | 381 | */ |
382 | - public function isRenderedAsSeparator (): bool { |
|
382 | + public function isRenderedAsSeparator(): bool { |
|
383 | 383 | return $this->_is('is_rendered_as_separator'); |
384 | 384 | } |
385 | 385 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * @depends after-create |
390 | 390 | * @return Story |
391 | 391 | */ |
392 | - public function newComment () { |
|
392 | + public function newComment() { |
|
393 | 393 | /** @var Story $comment */ |
394 | 394 | $comment = $this->factory(Story::class, [ |
395 | 395 | 'resource_subtype' => Story::TYPE_COMMENT_ADDED |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | * @depends after-create |
404 | 404 | * @return Task |
405 | 405 | */ |
406 | - public function newSubTask () { |
|
406 | + public function newSubTask() { |
|
407 | 407 | /** @var Task $sub */ |
408 | 408 | $sub = $this->factory(self::class); |
409 | 409 | return $sub->setParent($this); |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | /** |
413 | 413 | * Marks `custom_fields` clean. |
414 | 414 | */ |
415 | - protected function onUpdate (): void { |
|
415 | + protected function onUpdate(): void { |
|
416 | 416 | if ($this->hasCustomFields()) { |
417 | 417 | $this->getCustomFields()->diff = []; |
418 | 418 | } |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | * @param Task[] $tasks |
426 | 426 | * @return $this |
427 | 427 | */ |
428 | - public function removeDependencies (array $tasks) { |
|
428 | + public function removeDependencies(array $tasks) { |
|
429 | 429 | $this->api->post("{$this}/removeDependencies", ['dependencies' => static::_getGids($tasks)]); |
430 | 430 | return $this; |
431 | 431 | } |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * @param Task $task |
438 | 438 | * @return $this |
439 | 439 | */ |
440 | - public function removeDependency (Task $task) { |
|
440 | + public function removeDependency(Task $task) { |
|
441 | 441 | return $this->removeDependencies([$task]); |
442 | 442 | } |
443 | 443 | |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | * @param Task $task |
449 | 449 | * @return $this |
450 | 450 | */ |
451 | - public function removeDependent (Task $task) { |
|
451 | + public function removeDependent(Task $task) { |
|
452 | 452 | return $this->removeDependents([$task]); |
453 | 453 | } |
454 | 454 | |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | * @param Task[] $tasks |
460 | 460 | * @return $this |
461 | 461 | */ |
462 | - public function removeDependents (array $tasks) { |
|
462 | + public function removeDependents(array $tasks) { |
|
463 | 463 | $this->api->post("{$this}/removeDependents", ['dependents' => static::_getGids($tasks)]); |
464 | 464 | return $this; |
465 | 465 | } |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | * @param User $user |
471 | 471 | * @return $this |
472 | 472 | */ |
473 | - public function removeFollower (User $user) { |
|
473 | + public function removeFollower(User $user) { |
|
474 | 474 | return $this->removeFollowers([$user]); |
475 | 475 | } |
476 | 476 | |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * @param User[] $users |
481 | 481 | * @return $this |
482 | 482 | */ |
483 | - public function removeFollowers (array $users) { |
|
483 | + public function removeFollowers(array $users) { |
|
484 | 484 | if ($this->hasGid()) { |
485 | 485 | $this->api->post("{$this}/removeFollowers", ['followers' => static::_getGids($users)]); |
486 | 486 | } |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | * @param Project $project |
495 | 495 | * @return $this |
496 | 496 | */ |
497 | - public function removeFromProject (Project $project) { |
|
497 | + public function removeFromProject(Project $project) { |
|
498 | 498 | $gid = $project->getGid(); |
499 | 499 | if ($this->hasGid()) { |
500 | 500 | $this->api->post("{$this}/removeProject", ['project' => $gid]); |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | * @param Tag $tag |
514 | 514 | * @return $this |
515 | 515 | */ |
516 | - public function removeTag (Tag $tag) { |
|
516 | + public function removeTag(Tag $tag) { |
|
517 | 517 | if ($this->hasGid()) { |
518 | 518 | $this->api->post("{$this}/removeTag", ['tag' => $tag->getGid()]); |
519 | 519 | } |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | * @param null|Task $parent |
528 | 528 | * @return $this |
529 | 529 | */ |
530 | - public function setParent (?self $parent) { |
|
530 | + public function setParent(?self $parent) { |
|
531 | 531 | if ($this->hasGid()) { |
532 | 532 | $this->api->post("{$this}/setParent", ['parent' => $parent ? $parent->getGid() : null]); |
533 | 533 | $this->data['parent'] = $parent; |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | * @param bool $flag |
543 | 543 | * @return $this |
544 | 544 | */ |
545 | - public function setRenderedAsSeparator (bool $flag) { |
|
545 | + public function setRenderedAsSeparator(bool $flag) { |
|
546 | 546 | return $this->_set('is_rendered_as_separator', $flag); |
547 | 547 | } |
548 | 548 |
@@ -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 |