@@ -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 | ]); |
@@ -70,15 +70,15 @@ discard block |
||
70 | 70 | const ASSIGN_TODAY = 'today'; |
71 | 71 | const ASSIGN_UPCOMING = 'upcoming'; |
72 | 72 | |
73 | - final public function __toString (): string { |
|
73 | + final public function __toString(): string { |
|
74 | 74 | return "tasks/{$this->getGid()}"; |
75 | 75 | } |
76 | 76 | |
77 | - final protected function _getDir (): string { |
|
77 | + final protected function _getDir(): string { |
|
78 | 78 | return 'tasks'; |
79 | 79 | } |
80 | 80 | |
81 | - protected function _getMap (): array { |
|
81 | + protected function _getMap(): array { |
|
82 | 82 | return [ |
83 | 83 | 'assignee' => User::class, |
84 | 84 | 'custom_fields' => CustomValues::class, |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param string $file |
100 | 100 | * @return Attachment |
101 | 101 | */ |
102 | - public function addAttachment (string $file) { |
|
102 | + public function addAttachment(string $file) { |
|
103 | 103 | /** @var Attachment $attachment */ |
104 | 104 | $attachment = $this->factory(Attachment::class, ['parent' => $this]); |
105 | 105 | return $attachment->upload($file); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @param string $text |
113 | 113 | * @return Story |
114 | 114 | */ |
115 | - public function addComment (string $text) { |
|
115 | + public function addComment(string $text) { |
|
116 | 116 | return $this->newComment()->setText($text)->create(); |
117 | 117 | } |
118 | 118 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param Task[] $tasks |
124 | 124 | * @return $this |
125 | 125 | */ |
126 | - public function addDependencies (array $tasks) { |
|
126 | + public function addDependencies(array $tasks) { |
|
127 | 127 | $this->api->post("{$this}/addDependencies", ['dependents' => static::_getGids($tasks)]); |
128 | 128 | return $this; |
129 | 129 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @param Task $task |
136 | 136 | * @return $this |
137 | 137 | */ |
138 | - public function addDependency (Task $task) { |
|
138 | + public function addDependency(Task $task) { |
|
139 | 139 | return $this->addDependencies([$task]); |
140 | 140 | } |
141 | 141 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param Task $task |
147 | 147 | * @return $this |
148 | 148 | */ |
149 | - public function addDependent (Task $task) { |
|
149 | + public function addDependent(Task $task) { |
|
150 | 150 | return $this->addDependents([$task]); |
151 | 151 | } |
152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param Task[] $tasks |
158 | 158 | * @return $this |
159 | 159 | */ |
160 | - public function addDependents (array $tasks) { |
|
160 | + public function addDependents(array $tasks) { |
|
161 | 161 | $this->api->post("{$this}/addDependents", ['dependents' => static::_getGids($tasks)]); |
162 | 162 | return $this; |
163 | 163 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * @param User $user |
169 | 169 | * @return $this |
170 | 170 | */ |
171 | - public function addFollower (User $user) { |
|
171 | + public function addFollower(User $user) { |
|
172 | 172 | return $this->addFollowers([$user]); |
173 | 173 | } |
174 | 174 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * @param User[] $users |
179 | 179 | * @return $this |
180 | 180 | */ |
181 | - public function addFollowers (array $users) { |
|
181 | + public function addFollowers(array $users) { |
|
182 | 182 | if ($this->hasGid()) { |
183 | 183 | $this->api->post("{$this}/addFollowers", ['followers' => static::_getGids($users)]); |
184 | 184 | $this->_merge('followers', $users); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @param Tag $tag |
196 | 196 | * @return $this |
197 | 197 | */ |
198 | - public function addTag (Tag $tag) { |
|
198 | + public function addTag(Tag $tag) { |
|
199 | 199 | if ($this->hasGid()) { |
200 | 200 | $this->api->post("{$this}/addTag", ['tag' => $tag->getGid()]); |
201 | 201 | $this->_merge('tags', [$tag]); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @param Section $section |
213 | 213 | * @return $this |
214 | 214 | */ |
215 | - public function addToProject (Section $section) { |
|
215 | + public function addToProject(Section $section) { |
|
216 | 216 | $project = $section->getProject(); |
217 | 217 | if ($this->hasGid()) { |
218 | 218 | $this->api->post("{$this}/addProject", [ |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @param string $target |
247 | 247 | * @return TaskWebhook |
248 | 248 | */ |
249 | - public function addWebhook (string $target) { |
|
249 | + public function addWebhook(string $target) { |
|
250 | 250 | /** @var TaskWebhook $webhook */ |
251 | 251 | $webhook = $this->factory(TaskWebhook::class); |
252 | 252 | return $webhook->create($this, $target); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @param string[] $include |
263 | 263 | * @return Job |
264 | 264 | */ |
265 | - public function duplicate (string $name, array $include) { |
|
265 | + public function duplicate(string $name, array $include) { |
|
266 | 266 | $remote = $this->api->post("{$this}/duplicate", [ |
267 | 267 | 'name' => $name, |
268 | 268 | 'include' => array_values($include) |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @depends after-create |
277 | 277 | * @return Attachment[] |
278 | 278 | */ |
279 | - public function getAttachments () { |
|
279 | + public function getAttachments() { |
|
280 | 280 | return $this->loadAll(Attachment::class, "{$this}/attachments"); |
281 | 281 | } |
282 | 282 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * @depends after-create |
287 | 287 | * @return Story[] |
288 | 288 | */ |
289 | - public function getComments () { |
|
289 | + public function getComments() { |
|
290 | 290 | return array_values(array_filter($this->getStories(), function(Story $story) { |
291 | 291 | return $story->isComment(); |
292 | 292 | })); |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | * @depends after-create |
299 | 299 | * @return Task[] |
300 | 300 | */ |
301 | - public function getDependencies () { |
|
301 | + public function getDependencies() { |
|
302 | 302 | return $this->loadAll(self::class, "{$this}/dependencies"); |
303 | 303 | } |
304 | 304 | |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | * @depends after-create |
309 | 309 | * @return Task[] |
310 | 310 | */ |
311 | - public function getDependents () { |
|
311 | + public function getDependents() { |
|
312 | 312 | return $this->loadAll(self::class, "{$this}/dependents"); |
313 | 313 | } |
314 | 314 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @param null|string $token |
320 | 320 | * @return TaskEvent[]|StoryEvent[] |
321 | 321 | */ |
322 | - public function getEvents (&$token) { |
|
322 | + public function getEvents(&$token) { |
|
323 | 323 | return $this->api->sync($this, $token); |
324 | 324 | } |
325 | 325 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * @depends after-create |
330 | 330 | * @return Story[] |
331 | 331 | */ |
332 | - public function getStories () { |
|
332 | + public function getStories() { |
|
333 | 333 | return $this->loadAll(Story::class, "{$this}/stories"); |
334 | 334 | } |
335 | 335 | |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | * @depends after-create |
340 | 340 | * @return Task[] |
341 | 341 | */ |
342 | - public function getSubTasks () { |
|
342 | + public function getSubTasks() { |
|
343 | 343 | return $this->loadAll(self::class, "{$this}/subtasks"); |
344 | 344 | } |
345 | 345 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | * @depends after-create |
350 | 350 | * @return string |
351 | 351 | */ |
352 | - public function getUrl (): string { |
|
352 | + public function getUrl(): string { |
|
353 | 353 | return "https://app.asana.com/0/0/{$this->getGid()}"; |
354 | 354 | } |
355 | 355 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * @depends after-create |
360 | 360 | * @return TaskWebhook[] |
361 | 361 | */ |
362 | - public function getWebhooks () { |
|
362 | + public function getWebhooks() { |
|
363 | 363 | return $this->loadAll(TaskWebhook::class, 'webhooks', [ |
364 | 364 | 'workspace' => $this->getWorkspace()->getGid(), |
365 | 365 | 'resource' => $this->getGid() |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | /** |
370 | 370 | * @return bool |
371 | 371 | */ |
372 | - public function isRenderedAsSeparator (): bool { |
|
372 | + public function isRenderedAsSeparator(): bool { |
|
373 | 373 | return $this->_is('is_rendered_as_separator'); |
374 | 374 | } |
375 | 375 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | * @depends after-create |
380 | 380 | * @return Story |
381 | 381 | */ |
382 | - public function newComment () { |
|
382 | + public function newComment() { |
|
383 | 383 | /** @var Story $comment */ |
384 | 384 | $comment = $this->factory(Story::class, [ |
385 | 385 | 'resource_subtype' => Story::TYPE_COMMENT_ADDED |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | * @depends after-create |
394 | 394 | * @return Task |
395 | 395 | */ |
396 | - public function newSubTask () { |
|
396 | + public function newSubTask() { |
|
397 | 397 | /** @var Task $sub */ |
398 | 398 | $sub = $this->factory(self::class); |
399 | 399 | return $sub->setParent($this); |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | * @param Task[] $tasks |
407 | 407 | * @return $this |
408 | 408 | */ |
409 | - public function removeDependencies (array $tasks) { |
|
409 | + public function removeDependencies(array $tasks) { |
|
410 | 410 | $this->api->post("{$this}/removeDependencies", ['dependencies' => static::_getGids($tasks)]); |
411 | 411 | return $this; |
412 | 412 | } |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * @param Task $task |
419 | 419 | * @return $this |
420 | 420 | */ |
421 | - public function removeDependency (Task $task) { |
|
421 | + public function removeDependency(Task $task) { |
|
422 | 422 | return $this->removeDependencies([$task]); |
423 | 423 | } |
424 | 424 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @param Task $task |
430 | 430 | * @return $this |
431 | 431 | */ |
432 | - public function removeDependent (Task $task) { |
|
432 | + public function removeDependent(Task $task) { |
|
433 | 433 | return $this->removeDependents([$task]); |
434 | 434 | } |
435 | 435 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | * @param Task[] $tasks |
441 | 441 | * @return $this |
442 | 442 | */ |
443 | - public function removeDependents (array $tasks) { |
|
443 | + public function removeDependents(array $tasks) { |
|
444 | 444 | $this->api->post("{$this}/removeDependents", ['dependents' => static::_getGids($tasks)]); |
445 | 445 | return $this; |
446 | 446 | } |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | * @param User $user |
452 | 452 | * @return $this |
453 | 453 | */ |
454 | - public function removeFollower (User $user) { |
|
454 | + public function removeFollower(User $user) { |
|
455 | 455 | return $this->removeFollowers([$user]); |
456 | 456 | } |
457 | 457 | |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | * @param User[] $users |
462 | 462 | * @return $this |
463 | 463 | */ |
464 | - public function removeFollowers (array $users) { |
|
464 | + public function removeFollowers(array $users) { |
|
465 | 465 | if ($this->hasGid()) { |
466 | 466 | $this->api->post("{$this}/removeFollowers", ['followers' => static::_getGids($users)]); |
467 | 467 | } |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | * @param Project $project |
476 | 476 | * @return $this |
477 | 477 | */ |
478 | - public function removeFromProject (Project $project) { |
|
478 | + public function removeFromProject(Project $project) { |
|
479 | 479 | $gid = $project->getGid(); |
480 | 480 | if ($this->hasGid()) { |
481 | 481 | $this->api->post("{$this}/removeProject", ['project' => $gid]); |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | * @param Tag $tag |
495 | 495 | * @return $this |
496 | 496 | */ |
497 | - public function removeTag (Tag $tag) { |
|
497 | + public function removeTag(Tag $tag) { |
|
498 | 498 | if ($this->hasGid()) { |
499 | 499 | $this->api->post("{$this}/removeTag", ['tag' => $tag->getGid()]); |
500 | 500 | } |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | * @param null|Task $parent |
509 | 509 | * @return $this |
510 | 510 | */ |
511 | - public function setParent (?self $parent) { |
|
511 | + public function setParent(?self $parent) { |
|
512 | 512 | if ($this->hasGid()) { |
513 | 513 | $this->api->post("{$this}/setParent", ['parent' => $parent ? $parent->getGid() : null]); |
514 | 514 | $this->data['parent'] = $parent; |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | * @param bool $flag |
524 | 524 | * @return $this |
525 | 525 | */ |
526 | - public function setRenderedAsSeparator (bool $flag) { |
|
526 | + public function setRenderedAsSeparator(bool $flag) { |
|
527 | 527 | return $this->_set('is_rendered_as_separator', $flag); |
528 | 528 | } |
529 | 529 | } |
530 | 530 | \ No newline at end of file |
@@ -58,15 +58,15 @@ discard block |
||
58 | 58 | const LAYOUT_BOARD = 'board'; |
59 | 59 | const LAYOUT_LIST = 'list'; |
60 | 60 | |
61 | - final public function __toString (): string { |
|
61 | + final public function __toString(): string { |
|
62 | 62 | return "projects/{$this->getGid()}"; |
63 | 63 | } |
64 | 64 | |
65 | - final protected function _getDir (): string { |
|
65 | + final protected function _getDir(): string { |
|
66 | 66 | return 'projects'; |
67 | 67 | } |
68 | 68 | |
69 | - protected function _getMap (): array { |
|
69 | + protected function _getMap(): array { |
|
70 | 70 | return [ |
71 | 71 | 'current_status' => Status::class, |
72 | 72 | 'custom_fields' => CustomValues::class, |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param User $user |
84 | 84 | * @return $this |
85 | 85 | */ |
86 | - public function addMember (User $user) { |
|
86 | + public function addMember(User $user) { |
|
87 | 87 | return $this->addMembers([$user]); |
88 | 88 | } |
89 | 89 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @param User[] $users |
93 | 93 | * @return $this |
94 | 94 | */ |
95 | - public function addMembers (array $users) { |
|
95 | + public function addMembers(array $users) { |
|
96 | 96 | $this->api->post("{$this}/addMembers", ['members' => static::_getGids($users)]); |
97 | 97 | $this->_merge('members', $users); |
98 | 98 | return $this; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param string $target |
104 | 104 | * @return ProjectWebhook |
105 | 105 | */ |
106 | - public function addWebhook (string $target) { |
|
106 | + public function addWebhook(string $target) { |
|
107 | 107 | /** @var ProjectWebhook $webhook */ |
108 | 108 | $webhook = $this->factory(ProjectWebhook::class); |
109 | 109 | return $webhook->create($this, $target); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @param array $schedule |
129 | 129 | * @return Job |
130 | 130 | */ |
131 | - public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) { |
|
131 | + public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) { |
|
132 | 132 | $data = ['name' => $name]; |
133 | 133 | if ($team) { |
134 | 134 | $data['team'] = $team->getGid(); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @param null|string $token |
151 | 151 | * @return ProjectEvent[]|TaskEvent[]|StoryEvent[] |
152 | 152 | */ |
153 | - public function getEvents (&$token) { |
|
153 | + public function getEvents(&$token) { |
|
154 | 154 | return $this->api->sync($this, $token); |
155 | 155 | } |
156 | 156 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @depends after-create |
159 | 159 | * @return Section[] |
160 | 160 | */ |
161 | - public function getSections () { |
|
161 | + public function getSections() { |
|
162 | 162 | return $this->loadAll(Section::class, "{$this}/sections"); |
163 | 163 | } |
164 | 164 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @depends after-create |
167 | 167 | * @return Status[] |
168 | 168 | */ |
169 | - public function getStatuses () { |
|
169 | + public function getStatuses() { |
|
170 | 170 | return $this->loadAll(Status::class, "{$this}/project_statuses"); |
171 | 171 | } |
172 | 172 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * @param array $query |
176 | 176 | * @return Task[] |
177 | 177 | */ |
178 | - public function getTasks (array $query = []) { |
|
178 | + public function getTasks(array $query = []) { |
|
179 | 179 | $query['project'] = $this->getGid(); |
180 | 180 | return $this->loadAll(Task::class, "tasks", $query); |
181 | 181 | } |
@@ -184,25 +184,25 @@ discard block |
||
184 | 184 | * @depends after-create |
185 | 185 | * @return string |
186 | 186 | */ |
187 | - public function getUrl (): string { |
|
187 | + public function getUrl(): string { |
|
188 | 188 | return "https://app.asana.com/0/{$this->getGid()}"; |
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
192 | 192 | * @return ProjectWebhook[] |
193 | 193 | */ |
194 | - public function getWebhooks () { |
|
194 | + public function getWebhooks() { |
|
195 | 195 | return $this->loadAll(ProjectWebhook::class, 'webhooks', [ |
196 | 196 | 'workspace' => $this->getWorkspace()->getGid(), |
197 | 197 | 'resource' => $this->getGid() |
198 | 198 | ]); |
199 | 199 | } |
200 | 200 | |
201 | - public function isBoard (): bool { |
|
201 | + public function isBoard(): bool { |
|
202 | 202 | return $this->getLayout() === self::LAYOUT_BOARD; |
203 | 203 | } |
204 | 204 | |
205 | - public function isList (): bool { |
|
205 | + public function isList(): bool { |
|
206 | 206 | return $this->getLayout() === self::LAYOUT_LIST; |
207 | 207 | } |
208 | 208 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @depends after-create |
211 | 211 | * @return Section |
212 | 212 | */ |
213 | - public function newSection () { |
|
213 | + public function newSection() { |
|
214 | 214 | return $this->factory(Section::class, ['projects' => [$this]]); |
215 | 215 | } |
216 | 216 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @depends after-create |
219 | 219 | * @return Status |
220 | 220 | */ |
221 | - public function newStatus () { |
|
221 | + public function newStatus() { |
|
222 | 222 | return $this->factory(Status::class); |
223 | 223 | } |
224 | 224 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * @depends after-create |
229 | 229 | * @return Task |
230 | 230 | */ |
231 | - public function newTask () { |
|
231 | + public function newTask() { |
|
232 | 232 | return $this->getSections()[0]->newTask(); |
233 | 233 | } |
234 | 234 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @param User $user |
238 | 238 | * @return $this |
239 | 239 | */ |
240 | - public function removeMember (User $user) { |
|
240 | + public function removeMember(User $user) { |
|
241 | 241 | return $this->removeMembers([$user]); |
242 | 242 | } |
243 | 243 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @param User[] $users |
247 | 247 | * @return $this |
248 | 248 | */ |
249 | - public function removeMembers (array $users) { |
|
249 | + public function removeMembers(array $users) { |
|
250 | 250 | $this->api->post("{$this}/removeMembers", ['members' => static::_getGids($users)]); |
251 | 251 | $this->_remove('members', $users); |
252 | 252 | return $this; |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @param null|Team $team |
258 | 258 | * @return $this |
259 | 259 | */ |
260 | - public function setTeam (?Team $team) { |
|
260 | + public function setTeam(?Team $team) { |
|
261 | 261 | assert(!$this->hasGid()); |
262 | 262 | if ($team and !$this->hasWorkspace()) { |
263 | 263 | $this->setWorkspace($team->getOrganization()); |