Passed
Push — master ( 998eef...fb3ec1 )
by y
01:58
created
src/CustomField.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,15 +39,15 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Api.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -460,8 +460,7 @@
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -52,24 +52,24 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
460 460
      * @param null|string $token
461 461
      * @return ProjectEvent[]|TaskEvent[]|StoryEvent[]
462 462
      */
463
-    public function sync ($entity, ?string &$token) {
463
+    public function sync($entity, ?string &$token) {
464 464
         try {
465 465
             $response = $this->exec('GET', $this->getPath('events', [
466 466
                 'resource' => $entity->getGid(),
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
      * @param string $file
496 496
      * @return null|array
497 497
      */
498
-    public function upload (string $path, string $file) {
498
+    public function upload(string $path, string $file) {
499 499
         $response = $this->exec('POST', $path, [
500 500
             CURLOPT_POSTFIELDS => ['file' => new CURLFile(realpath($file))] // multipart/form-data
501 501
         ]);
Please login to merge, or discard this patch.
src/User/TaskList.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Task.php 2 patches
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -179,8 +179,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     const ASSIGN_TODAY = 'today';
80 80
     const ASSIGN_UPCOMING = 'upcoming';
81 81
 
82
-    public function __construct ($caller, array $data = []) {
82
+    public function __construct($caller, array $data = []) {
83 83
         parent::__construct($caller, $data);
84 84
 
85 85
         // Asana has a bug where it returns empty memberships when expanding "this".
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
         }
95 95
     }
96 96
 
97
-    final public function __toString (): string {
97
+    final public function __toString(): string {
98 98
         return "tasks/{$this->getGid()}";
99 99
     }
100 100
 
101 101
     /**
102 102
      * Clears the diffs for `custom_fields` and `external` sub-objects after saving.
103 103
      */
104
-    protected function _clearSubDiffs (): void {
104
+    protected function _clearSubDiffs(): void {
105 105
         // use isset() to avoid has() fetch.
106 106
         if (isset($this->data['custom_fields'])) {
107 107
             $this->getCustomFields()->diff = [];
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
         }
112 112
     }
113 113
 
114
-    final protected function _getDir (): string {
114
+    final protected function _getDir(): string {
115 115
         return 'tasks';
116 116
     }
117 117
 
118
-    protected function _getMap (): array {
118
+    protected function _getMap(): array {
119 119
         return [
120 120
             'assignee' => User::class,
121 121
             'custom_fields' => CustomValues::class,
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      * @param string $file
137 137
      * @return Attachment
138 138
      */
139
-    public function addAttachment (string $file) {
139
+    public function addAttachment(string $file) {
140 140
         /** @var Attachment $attachment */
141 141
         $attachment = $this->factory(Attachment::class, ['parent' => $this]);
142 142
         return $attachment->upload($file);
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      * @param string $text
149 149
      * @return Story
150 150
      */
151
-    public function addComment (string $text) {
151
+    public function addComment(string $text) {
152 152
         return $this->newComment()->setText($text)->create();
153 153
     }
154 154
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      * @param Task[] $tasks
160 160
      * @return $this
161 161
      */
162
-    public function addDependencies (array $tasks) {
162
+    public function addDependencies(array $tasks) {
163 163
         $this->api->post("{$this}/addDependencies", ['dependents' => static::_getGids($tasks)]);
164 164
         return $this;
165 165
     }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      * @param Task $task
172 172
      * @return $this
173 173
      */
174
-    public function addDependency (Task $task) {
174
+    public function addDependency(Task $task) {
175 175
         return $this->addDependencies([$task]);
176 176
     }
177 177
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      * @param Task $task
183 183
      * @return $this
184 184
      */
185
-    public function addDependent (Task $task) {
185
+    public function addDependent(Task $task) {
186 186
         return $this->addDependents([$task]);
187 187
     }
188 188
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
      * @param Task[] $tasks
194 194
      * @return $this
195 195
      */
196
-    public function addDependents (array $tasks) {
196
+    public function addDependents(array $tasks) {
197 197
         $this->api->post("{$this}/addDependents", ['dependents' => static::_getGids($tasks)]);
198 198
         return $this;
199 199
     }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      * @param User $user
205 205
      * @return $this
206 206
      */
207
-    public function addFollower (User $user) {
207
+    public function addFollower(User $user) {
208 208
         return $this->addFollowers([$user]);
209 209
     }
210 210
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
      * @param User[] $users
215 215
      * @return $this
216 216
      */
217
-    public function addFollowers (array $users) {
217
+    public function addFollowers(array $users) {
218 218
         if ($this->hasGid()) {
219 219
             $this->api->post("{$this}/addFollowers", ['followers' => static::_getGids($users)]);
220 220
             $this->_merge('followers', $users);
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
      * @param Tag $tag
232 232
      * @return $this
233 233
      */
234
-    public function addTag (Tag $tag) {
234
+    public function addTag(Tag $tag) {
235 235
         if ($this->hasGid()) {
236 236
             $this->api->post("{$this}/addTag", ['tag' => $tag->getGid()]);
237 237
             $this->_merge('tags', [$tag]);
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
      * @param Section $section
249 249
      * @return $this
250 250
      */
251
-    public function addToProject (Section $section) {
251
+    public function addToProject(Section $section) {
252 252
         $project = $section->getProject();
253 253
         if ($this->hasGid()) {
254 254
             $this->api->post("{$this}/addProject", [
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
      * @param string $target
283 283
      * @return TaskWebhook
284 284
      */
285
-    public function addWebhook (string $target) {
285
+    public function addWebhook(string $target) {
286 286
         /** @var TaskWebhook $webhook */
287 287
         $webhook = $this->factory(TaskWebhook::class);
288 288
         return $webhook->create($this, $target);
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
     /**
292 292
      * @return $this
293 293
      */
294
-    public function create () {
294
+    public function create() {
295 295
         $this->_create();
296 296
         $this->_clearSubDiffs();
297 297
         return $this;
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
      * @param string[] $include
308 308
      * @return Job
309 309
      */
310
-    public function duplicate (string $name, array $include) {
310
+    public function duplicate(string $name, array $include) {
311 311
         $remote = $this->api->post("{$this}/duplicate", [
312 312
             'name' => $name,
313 313
             'include' => array_values($include)
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
      * @depends after-create
322 322
      * @return Attachment[]
323 323
      */
324
-    public function getAttachments () {
324
+    public function getAttachments() {
325 325
         return $this->loadAll(Attachment::class, "{$this}/attachments");
326 326
     }
327 327
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
      * @depends after-create
332 332
      * @return Story[]
333 333
      */
334
-    public function getComments () {
334
+    public function getComments() {
335 335
         return array_values(array_filter($this->getStories(), function(Story $story) {
336 336
             return $story->isComment();
337 337
         }));
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
      * @depends after-create
344 344
      * @return Task[]
345 345
      */
346
-    public function getDependencies () {
346
+    public function getDependencies() {
347 347
         return $this->loadAll(self::class, "{$this}/dependencies");
348 348
     }
349 349
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
      * @depends after-create
354 354
      * @return Task[]
355 355
      */
356
-    public function getDependents () {
356
+    public function getDependents() {
357 357
         return $this->loadAll(self::class, "{$this}/dependents");
358 358
     }
359 359
 
@@ -364,21 +364,21 @@  discard block
 block discarded – undo
364 364
      * @param null|string $token
365 365
      * @return TaskEvent[]|StoryEvent[]
366 366
      */
367
-    public function getEvents (&$token) {
367
+    public function getEvents(&$token) {
368 368
         return $this->api->sync($this, $token);
369 369
     }
370 370
 
371 371
     /**
372 372
      * @return External
373 373
      */
374
-    public function getExternal () {
374
+    public function getExternal() {
375 375
         return $this->_get('external') ?? $this->data['external'] = $this->factory($this->_getMap()['external']);
376 376
     }
377 377
 
378 378
     /**
379 379
      * @return Project[]
380 380
      */
381
-    public function getProjects () {
381
+    public function getProjects() {
382 382
         return array_map(function(Membership $membership) {
383 383
             return $membership->getProject();
384 384
         }, $this->getMemberships());
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
      * @depends after-create
391 391
      * @return Story[]
392 392
      */
393
-    public function getStories () {
393
+    public function getStories() {
394 394
         return $this->loadAll(Story::class, "{$this}/stories");
395 395
     }
396 396
 
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
      * @depends after-create
401 401
      * @return Task[]
402 402
      */
403
-    public function getSubTasks () {
403
+    public function getSubTasks() {
404 404
         return $this->loadAll(self::class, "{$this}/subtasks");
405 405
     }
406 406
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
      * @depends after-create
411 411
      * @return string
412 412
      */
413
-    public function getUrl (): string {
413
+    public function getUrl(): string {
414 414
         return "https://app.asana.com/0/0/{$this->getGid()}";
415 415
     }
416 416
 
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
      * @depends after-create
421 421
      * @return TaskWebhook[]
422 422
      */
423
-    public function getWebhooks () {
423
+    public function getWebhooks() {
424 424
         return $this->loadAll(TaskWebhook::class, 'webhooks', [
425 425
             'workspace' => $this->getWorkspace()->getGid(),
426 426
             'resource' => $this->getGid()
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
     /**
431 431
      * @return bool
432 432
      */
433
-    public function isRenderedAsSeparator (): bool {
433
+    public function isRenderedAsSeparator(): bool {
434 434
         return $this->_is('is_rendered_as_separator');
435 435
     }
436 436
 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
      * @depends after-create
441 441
      * @return Story
442 442
      */
443
-    public function newComment () {
443
+    public function newComment() {
444 444
         /** @var Story $comment */
445 445
         $comment = $this->factory(Story::class, [
446 446
             'resource_subtype' => Story::TYPE_COMMENT_ADDED
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
      * @depends after-create
455 455
      * @return Task
456 456
      */
457
-    public function newSubTask () {
457
+    public function newSubTask() {
458 458
         /** @var Task $sub */
459 459
         $sub = $this->factory(self::class);
460 460
         return $sub->setParent($this);
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
      * @param Task[] $tasks
468 468
      * @return $this
469 469
      */
470
-    public function removeDependencies (array $tasks) {
470
+    public function removeDependencies(array $tasks) {
471 471
         $this->api->post("{$this}/removeDependencies", ['dependencies' => static::_getGids($tasks)]);
472 472
         return $this;
473 473
     }
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
      * @param Task $task
480 480
      * @return $this
481 481
      */
482
-    public function removeDependency (Task $task) {
482
+    public function removeDependency(Task $task) {
483 483
         return $this->removeDependencies([$task]);
484 484
     }
485 485
 
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
      * @param Task $task
491 491
      * @return $this
492 492
      */
493
-    public function removeDependent (Task $task) {
493
+    public function removeDependent(Task $task) {
494 494
         return $this->removeDependents([$task]);
495 495
     }
496 496
 
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
      * @param Task[] $tasks
502 502
      * @return $this
503 503
      */
504
-    public function removeDependents (array $tasks) {
504
+    public function removeDependents(array $tasks) {
505 505
         $this->api->post("{$this}/removeDependents", ['dependents' => static::_getGids($tasks)]);
506 506
         return $this;
507 507
     }
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
      * @param User $user
513 513
      * @return $this
514 514
      */
515
-    public function removeFollower (User $user) {
515
+    public function removeFollower(User $user) {
516 516
         return $this->removeFollowers([$user]);
517 517
     }
518 518
 
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
      * @param User[] $users
523 523
      * @return $this
524 524
      */
525
-    public function removeFollowers (array $users) {
525
+    public function removeFollowers(array $users) {
526 526
         if ($this->hasGid()) {
527 527
             $this->api->post("{$this}/removeFollowers", ['followers' => static::_getGids($users)]);
528 528
         }
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
      * @param Project $project
537 537
      * @return $this
538 538
      */
539
-    public function removeFromProject (Project $project) {
539
+    public function removeFromProject(Project $project) {
540 540
         $gid = $project->getGid();
541 541
         if ($this->hasGid()) {
542 542
             $this->api->post("{$this}/removeProject", ['project' => $gid]);
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
      * @param Tag $tag
556 556
      * @return $this
557 557
      */
558
-    public function removeTag (Tag $tag) {
558
+    public function removeTag(Tag $tag) {
559 559
         if ($this->hasGid()) {
560 560
             $this->api->post("{$this}/removeTag", ['tag' => $tag->getGid()]);
561 561
         }
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
      * @param null|Task $parent
570 570
      * @return $this
571 571
      */
572
-    public function setParent (?self $parent) {
572
+    public function setParent(?self $parent) {
573 573
         if ($this->hasGid()) {
574 574
             $this->api->post("{$this}/setParent", ['parent' => $parent ? $parent->getGid() : null]);
575 575
             $this->data['parent'] = $parent;
@@ -584,14 +584,14 @@  discard block
 block discarded – undo
584 584
      * @param bool $flag
585 585
      * @return $this
586 586
      */
587
-    public function setRenderedAsSeparator (bool $flag) {
587
+    public function setRenderedAsSeparator(bool $flag) {
588 588
         return $this->_set('is_rendered_as_separator', $flag);
589 589
     }
590 590
 
591 591
     /**
592 592
      * @return $this
593 593
      */
594
-    public function update () {
594
+    public function update() {
595 595
         $this->_update();
596 596
         $this->_clearSubDiffs();
597 597
         return $this;
Please login to merge, or discard this patch.
src/Task/Like.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
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
         ];
Please login to merge, or discard this patch.
src/Task/Membership.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Task/Attachment.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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'];
Please login to merge, or discard this patch.
src/Task/Story.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,15 +39,15 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Tag.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,15 +26,15 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.