Passed
Push — master ( 1a00b5...984447 )
by y
03:02
created
src/Color.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
     /**
36 36
      * @return string
37 37
      */
38
-    public static function random () {
38
+    public static function random() {
39 39
         try {
40 40
             $colors = (new ReflectionClass(self::class))->getConstants();
41 41
             return $colors[array_rand($colors)];
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,7 @@
 block discarded – undo
39 39
         try {
40 40
             $colors = (new ReflectionClass(self::class))->getConstants();
41 41
             return $colors[array_rand($colors)];
42
-        }
43
-        catch (ReflectionException $exception) {
42
+        } catch (ReflectionException $exception) {
44 43
             return 'none'; // unreachable
45 44
         }
46 45
     }
Please login to merge, or discard this patch.
src/CustomField/EnumOption.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,23 +37,23 @@  discard block
 block discarded – undo
37 37
      * @param CustomField $customField
38 38
      * @param array $data
39 39
      */
40
-    public function __construct (CustomField $customField, array $data = []) {
40
+    public function __construct(CustomField $customField, array $data = []) {
41 41
         parent::__construct($customField, $data);
42 42
         $this->customField = $customField;
43 43
     }
44 44
 
45
-    final public function __toString (): string {
45
+    final public function __toString(): string {
46 46
         return "enum_options/{$this->getGid()}";
47 47
     }
48 48
 
49
-    final protected function _getDir (): string {
49
+    final protected function _getDir(): string {
50 50
         return "{$this->customField}/enum_options";
51 51
     }
52 52
 
53 53
     /**
54 54
      * @return CustomField
55 55
      */
56
-    public function getCustomField () {
56
+    public function getCustomField() {
57 57
         return $this->customField;
58 58
     }
59 59
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @param EnumOption $option
62 62
      * @return $this
63 63
      */
64
-    public function insertAfter (EnumOption $option) {
64
+    public function insertAfter(EnumOption $option) {
65 65
         assert($option->hasGid());
66 66
         if ($this->hasGid()) {
67 67
             $this->api->post("{$this->_getDir()}/insert", [
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      * @param EnumOption $option
81 81
      * @return $this
82 82
      */
83
-    public function insertBefore (EnumOption $option) {
83
+    public function insertBefore(EnumOption $option) {
84 84
         assert($option->hasGid());
85 85
         if ($this->hasGid()) {
86 86
             $this->api->post("{$this->_getDir()}/insert", [
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,8 +68,7 @@  discard block
 block discarded – undo
68 68
                 'enum_option' => $this->getGid(),
69 69
                 'after_enum_option' => $option->getGid()
70 70
             ]);
71
-        }
72
-        else {
71
+        } else {
73 72
             unset($this->data['insert_before'], $this->diff['insert_before']);
74 73
             $this->_set('insert_after', $option->getGid());
75 74
         }
@@ -87,8 +86,7 @@  discard block
 block discarded – undo
87 86
                 'enum_option' => $this->getGid(),
88 87
                 'before_enum_option' => $option->getGid()
89 88
             ]);
90
-        }
91
-        else {
89
+        } else {
92 90
             unset($this->data['insert_after'], $this->diff['insert_after']);
93 91
             $this->_set('insert_before', $option->getGid());
94 92
         }
Please login to merge, or discard this patch.
src/Webhook/AbstractWebhook.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
     }
31 31
     use DeleteTrait;
32 32
 
33
-    final public function __toString (): string {
33
+    final public function __toString(): string {
34 34
         return "webhooks/{$this->getGid()}";
35 35
     }
36 36
 
37
-    final protected function _getDir (): string {
37
+    final protected function _getDir(): string {
38 38
         return 'webhooks';
39 39
     }
40 40
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      * @param string $target
44 44
      * @return $this
45 45
      */
46
-    public function create ($resource, string $target) {
46
+    public function create($resource, string $target) {
47 47
         $this->_set('resource', $resource);
48 48
         $this->_set('target', $target);
49 49
         return $this->_create();
Please login to merge, or discard this patch.
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   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
         'enum_options' => [EnumOption::class],
41 41
     ];
42 42
 
43
-    final public function __toString (): string {
43
+    final public function __toString(): string {
44 44
         return "custom_fields/{$this->getGid()}";
45 45
     }
46 46
 
47
-    final protected function _getDir (): string {
47
+    final protected function _getDir(): string {
48 48
         return 'custom_fields';
49 49
     }
50 50
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      * @param string $name
53 53
      * @return EnumOption
54 54
      */
55
-    public function addEnumOption (string $name) {
55
+    public function addEnumOption(string $name) {
56 56
         /** @var EnumOption $option */
57 57
         $option = $this->factory(EnumOption::class);
58 58
         $option->setName($name);
@@ -69,28 +69,28 @@  discard block
 block discarded – undo
69 69
     /**
70 70
      * @return bool
71 71
      */
72
-    public function hasNotificationsEnabled (): bool {
72
+    public function hasNotificationsEnabled(): bool {
73 73
         return $this->_is('has_notifications_enabled');
74 74
     }
75 75
 
76 76
     /**
77 77
      * @return bool
78 78
      */
79
-    public function isEnum (): bool {
79
+    public function isEnum(): bool {
80 80
         return $this->getResourceSubtype() === self::TYPE_ENUM;
81 81
     }
82 82
 
83 83
     /**
84 84
      * @return bool
85 85
      */
86
-    public function isGlobalToWorkspace (): bool {
86
+    public function isGlobalToWorkspace(): bool {
87 87
         return $this->_is('is_global_to_workspace');
88 88
     }
89 89
 
90 90
     /**
91 91
      * @return bool
92 92
      */
93
-    final public function isText (): bool {
93
+    final public function isText(): bool {
94 94
         return $this->getResourceSubtype() === self::TYPE_TEXT;
95 95
     }
96 96
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      * @param bool $flag
99 99
      * @return $this
100 100
      */
101
-    public function setGlobalToWorkspace (bool $flag) {
101
+    public function setGlobalToWorkspace(bool $flag) {
102 102
         return $this->_set('is_global_to_workspace', $flag);
103 103
     }
104 104
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      * @param bool $flag
107 107
      * @return $this
108 108
      */
109
-    public function setNotificationsEnabled (bool $flag) {
109
+    public function setNotificationsEnabled(bool $flag) {
110 110
         return $this->_set('has_notifications_enabled', $flag);
111 111
     }
112 112
 
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/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   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
         'memberships' => 'memberships.(project|section)'
96 96
     ];
97 97
 
98
-    final public function __toString (): string {
98
+    final public function __toString(): string {
99 99
         return "tasks/{$this->getGid()}";
100 100
     }
101 101
 
102 102
     /**
103 103
      * Clears the diffs for `custom_fields` and `external` sub-objects after saving.
104 104
      */
105
-    protected function _clearSubDiffs (): void {
105
+    protected function _clearSubDiffs(): void {
106 106
         // use isset() to avoid has() fetch.
107 107
         if (isset($this->data['custom_fields'])) {
108 108
             $this->getCustomFields()->diff = [];
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         }
113 113
     }
114 114
 
115
-    final protected function _getDir (): string {
115
+    final protected function _getDir(): string {
116 116
         return 'tasks';
117 117
     }
118 118
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      * @param string $file
124 124
      * @return Attachment
125 125
      */
126
-    public function addAttachment (string $file) {
126
+    public function addAttachment(string $file) {
127 127
         /** @var Attachment $attachment */
128 128
         $attachment = $this->factory(Attachment::class, ['parent' => $this]);
129 129
         return $attachment->upload($file);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      * @param string $text
136 136
      * @return Story
137 137
      */
138
-    public function addComment (string $text) {
138
+    public function addComment(string $text) {
139 139
         return $this->newComment()->setText($text)->create();
140 140
     }
141 141
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      * @param Task[] $tasks
147 147
      * @return $this
148 148
      */
149
-    public function addDependencies (array $tasks) {
149
+    public function addDependencies(array $tasks) {
150 150
         $this->api->post("{$this}/addDependencies", ['dependents' => static::_getGids($tasks)]);
151 151
         return $this;
152 152
     }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      * @param Task $task
159 159
      * @return $this
160 160
      */
161
-    public function addDependency (Task $task) {
161
+    public function addDependency(Task $task) {
162 162
         return $this->addDependencies([$task]);
163 163
     }
164 164
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      * @param Task $task
170 170
      * @return $this
171 171
      */
172
-    public function addDependent (Task $task) {
172
+    public function addDependent(Task $task) {
173 173
         return $this->addDependents([$task]);
174 174
     }
175 175
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
      * @param Task[] $tasks
181 181
      * @return $this
182 182
      */
183
-    public function addDependents (array $tasks) {
183
+    public function addDependents(array $tasks) {
184 184
         $this->api->post("{$this}/addDependents", ['dependents' => static::_getGids($tasks)]);
185 185
         return $this;
186 186
     }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      * @param User $user
192 192
      * @return $this
193 193
      */
194
-    public function addFollower (User $user) {
194
+    public function addFollower(User $user) {
195 195
         return $this->addFollowers([$user]);
196 196
     }
197 197
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
      * @param User[] $users
202 202
      * @return $this
203 203
      */
204
-    public function addFollowers (array $users) {
204
+    public function addFollowers(array $users) {
205 205
         if ($this->hasGid()) {
206 206
             $this->api->post("{$this}/addFollowers", ['followers' => static::_getGids($users)]);
207 207
             $this->_merge('followers', $users);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
      * @param Tag $tag
219 219
      * @return $this
220 220
      */
221
-    public function addTag (Tag $tag) {
221
+    public function addTag(Tag $tag) {
222 222
         if ($this->hasGid()) {
223 223
             $this->api->post("{$this}/addTag", ['tag' => $tag->getGid()]);
224 224
             $this->_merge('tags', [$tag]);
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      * @param Section $section
236 236
      * @return $this
237 237
      */
238
-    public function addToProject (Section $section) {
238
+    public function addToProject(Section $section) {
239 239
         $project = $section->getProject();
240 240
         if ($this->hasGid()) {
241 241
             $this->api->post("{$this}/addProject", [
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
      * @param string $target
270 270
      * @return TaskWebhook
271 271
      */
272
-    public function addWebhook (string $target) {
272
+    public function addWebhook(string $target) {
273 273
         /** @var TaskWebhook $webhook */
274 274
         $webhook = $this->factory(TaskWebhook::class);
275 275
         return $webhook->create($this, $target);
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     /**
279 279
      * @return $this
280 280
      */
281
-    public function create () {
281
+    public function create() {
282 282
         $this->_create();
283 283
         $this->_clearSubDiffs();
284 284
         return $this;
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
      * @param string[] $include
295 295
      * @return Job
296 296
      */
297
-    public function duplicate (string $name, array $include) {
297
+    public function duplicate(string $name, array $include) {
298 298
         $remote = $this->api->post("{$this}/duplicate", [
299 299
             'name' => $name,
300 300
             'include' => array_values($include)
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      * @depends after-create
309 309
      * @return Attachment[]
310 310
      */
311
-    public function getAttachments () {
311
+    public function getAttachments() {
312 312
         return $this->loadAll(Attachment::class, "{$this}/attachments");
313 313
     }
314 314
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
      * @depends after-create
319 319
      * @return Story[]
320 320
      */
321
-    public function getComments () {
321
+    public function getComments() {
322 322
         return array_values(array_filter($this->getStories(), function(Story $story) {
323 323
             return $story->isComment();
324 324
         }));
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
      * @depends after-create
331 331
      * @return Task[]
332 332
      */
333
-    public function getDependencies () {
333
+    public function getDependencies() {
334 334
         return $this->loadAll(self::class, "{$this}/dependencies");
335 335
     }
336 336
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
      * @depends after-create
341 341
      * @return Task[]
342 342
      */
343
-    public function getDependents () {
343
+    public function getDependents() {
344 344
         return $this->loadAll(self::class, "{$this}/dependents");
345 345
     }
346 346
 
@@ -351,21 +351,21 @@  discard block
 block discarded – undo
351 351
      * @param null|string $token
352 352
      * @return TaskEvent[]|StoryEvent[]
353 353
      */
354
-    public function getEvents (&$token) {
354
+    public function getEvents(&$token) {
355 355
         return $this->api->sync($this, $token);
356 356
     }
357 357
 
358 358
     /**
359 359
      * @return External
360 360
      */
361
-    public function getExternal () {
361
+    public function getExternal() {
362 362
         return $this->_get('external') ?? $this->data['external'] = $this->factory(static::$map['external']);
363 363
     }
364 364
 
365 365
     /**
366 366
      * @return Project[]
367 367
      */
368
-    public function getProjects () {
368
+    public function getProjects() {
369 369
         return array_map(function(Membership $membership) {
370 370
             return $membership->getProject();
371 371
         }, $this->getMemberships());
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
      * @depends after-create
378 378
      * @return Story[]
379 379
      */
380
-    public function getStories () {
380
+    public function getStories() {
381 381
         return $this->loadAll(Story::class, "{$this}/stories");
382 382
     }
383 383
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
      * @depends after-create
388 388
      * @return Task[]
389 389
      */
390
-    public function getSubTasks () {
390
+    public function getSubTasks() {
391 391
         return $this->loadAll(self::class, "{$this}/subtasks");
392 392
     }
393 393
 
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
      * @depends after-create
398 398
      * @return string
399 399
      */
400
-    public function getUrl (): string {
400
+    public function getUrl(): string {
401 401
         return "https://app.asana.com/0/0/{$this->getGid()}";
402 402
     }
403 403
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
      * @depends after-create
408 408
      * @return TaskWebhook[]
409 409
      */
410
-    public function getWebhooks () {
410
+    public function getWebhooks() {
411 411
         return $this->loadAll(TaskWebhook::class, 'webhooks', [
412 412
             'workspace' => $this->getWorkspace()->getGid(),
413 413
             'resource' => $this->getGid()
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
     /**
418 418
      * @return bool
419 419
      */
420
-    public function isRenderedAsSeparator (): bool {
420
+    public function isRenderedAsSeparator(): bool {
421 421
         return $this->_is('is_rendered_as_separator');
422 422
     }
423 423
 
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
      * @depends after-create
428 428
      * @return Story
429 429
      */
430
-    public function newComment () {
430
+    public function newComment() {
431 431
         /** @var Story $comment */
432 432
         $comment = $this->factory(Story::class, [
433 433
             'resource_subtype' => Story::TYPE_COMMENT_ADDED
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
      * @depends after-create
442 442
      * @return Task
443 443
      */
444
-    public function newSubTask () {
444
+    public function newSubTask() {
445 445
         /** @var Task $sub */
446 446
         $sub = $this->factory(self::class);
447 447
         return $sub->setParent($this);
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
      * @param Task[] $tasks
455 455
      * @return $this
456 456
      */
457
-    public function removeDependencies (array $tasks) {
457
+    public function removeDependencies(array $tasks) {
458 458
         $this->api->post("{$this}/removeDependencies", ['dependencies' => static::_getGids($tasks)]);
459 459
         return $this;
460 460
     }
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
      * @param Task $task
467 467
      * @return $this
468 468
      */
469
-    public function removeDependency (Task $task) {
469
+    public function removeDependency(Task $task) {
470 470
         return $this->removeDependencies([$task]);
471 471
     }
472 472
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
      * @param Task $task
478 478
      * @return $this
479 479
      */
480
-    public function removeDependent (Task $task) {
480
+    public function removeDependent(Task $task) {
481 481
         return $this->removeDependents([$task]);
482 482
     }
483 483
 
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
      * @param Task[] $tasks
489 489
      * @return $this
490 490
      */
491
-    public function removeDependents (array $tasks) {
491
+    public function removeDependents(array $tasks) {
492 492
         $this->api->post("{$this}/removeDependents", ['dependents' => static::_getGids($tasks)]);
493 493
         return $this;
494 494
     }
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
      * @param User $user
500 500
      * @return $this
501 501
      */
502
-    public function removeFollower (User $user) {
502
+    public function removeFollower(User $user) {
503 503
         return $this->removeFollowers([$user]);
504 504
     }
505 505
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
      * @param User[] $users
510 510
      * @return $this
511 511
      */
512
-    public function removeFollowers (array $users) {
512
+    public function removeFollowers(array $users) {
513 513
         if ($this->hasGid()) {
514 514
             $this->api->post("{$this}/removeFollowers", ['followers' => static::_getGids($users)]);
515 515
         }
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
      * @param Project $project
524 524
      * @return $this
525 525
      */
526
-    public function removeFromProject (Project $project) {
526
+    public function removeFromProject(Project $project) {
527 527
         $gid = $project->getGid();
528 528
         if ($this->hasGid()) {
529 529
             $this->api->post("{$this}/removeProject", ['project' => $gid]);
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
      * @param Tag $tag
543 543
      * @return $this
544 544
      */
545
-    public function removeTag (Tag $tag) {
545
+    public function removeTag(Tag $tag) {
546 546
         if ($this->hasGid()) {
547 547
             $this->api->post("{$this}/removeTag", ['tag' => $tag->getGid()]);
548 548
         }
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
      * @param null|Task $parent
557 557
      * @return $this
558 558
      */
559
-    public function setParent (?self $parent) {
559
+    public function setParent(?self $parent) {
560 560
         if ($this->hasGid()) {
561 561
             $this->api->post("{$this}/setParent", ['parent' => $parent ? $parent->getGid() : null]);
562 562
             $this->data['parent'] = $parent;
@@ -571,14 +571,14 @@  discard block
 block discarded – undo
571 571
      * @param bool $flag
572 572
      * @return $this
573 573
      */
574
-    public function setRenderedAsSeparator (bool $flag) {
574
+    public function setRenderedAsSeparator(bool $flag) {
575 575
         return $this->_set('is_rendered_as_separator', $flag);
576 576
     }
577 577
 
578 578
     /**
579 579
      * @return $this
580 580
      */
581
-    public function update () {
581
+    public function update() {
582 582
         $this->_update();
583 583
         $this->_clearSubDiffs();
584 584
         return $this;
Please login to merge, or discard this patch.
src/Base/AbstractEntity/WorkspaceTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
      * @param Workspace $workspace
18 18
      * @return $this
19 19
      */
20
-    public function setWorkspace (Workspace $workspace) {
20
+    public function setWorkspace(Workspace $workspace) {
21 21
         assert(!$this->hasGid());
22 22
         return $this->_set('workspace', $workspace);
23 23
     }
Please login to merge, or discard this patch.
src/Base/Data.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -291,11 +291,9 @@
 block discarded – undo
291 291
         $dehydrate = function($each) use (&$dehydrate) {
292 292
             if ($each instanceof AbstractEntity and $each->hasGid()) {
293 293
                 return $each->getGid();
294
-            }
295
-            elseif ($each instanceof self) {
294
+            } elseif ($each instanceof self) {
296 295
                 return $each->toArray();
297
-            }
298
-            elseif (is_array($each)) {
296
+            } elseif (is_array($each)) {
299 297
                 return array_map($dehydrate, $each);
300 298
             }
301 299
             return $each;
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      * @param Api|Data $caller
41 41
      * @param array $data
42 42
      */
43
-    public function __construct ($caller, array $data = []) {
43
+    public function __construct($caller, array $data = []) {
44 44
         $this->api = $caller instanceof self ? $caller->api : $caller;
45 45
         $this->_setData($data);
46 46
     }
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
      * @param array $args
57 57
      * @return mixed
58 58
      */
59
-    public function __call (string $method, array $args) {
59
+    public function __call(string $method, array $args) {
60 60
         static $cache = [];
61
-        if (!$call =& $cache[$method]) {
61
+        if (!$call = & $cache[$method]) {
62 62
             preg_match('/^(get|has|is|set)(.+)$/', $method, $call);
63 63
             $call[1] = '_' . $call[1];
64 64
             $call[2] = preg_replace_callback('/[A-Z]/', function(array $match) {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         return $this->{$call[1]}($call[2], ...$args);
69 69
     }
70 70
 
71
-    public function __debugInfo (): array {
71
+    public function __debugInfo(): array {
72 72
         return $this->data;
73 73
     }
74 74
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      * @param $key
79 79
      * @return null|Data|mixed
80 80
      */
81
-    final public function __get ($key) {
81
+    final public function __get($key) {
82 82
         return $this->_get($key);
83 83
     }
84 84
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      * @param $key
91 91
      * @return bool
92 92
      */
93
-    final public function __isset ($key) {
93
+    final public function __isset($key) {
94 94
         return true;
95 95
     }
96 96
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      * @param string $key
103 103
      * @return mixed
104 104
      */
105
-    protected function _get (string $key) {
105
+    protected function _get(string $key) {
106 106
         return $this->data[$key] ?? null;
107 107
     }
108 108
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      * @param string $key
117 117
      * @return bool
118 118
      */
119
-    protected function _has (string $key): bool {
119
+    protected function _has(string $key): bool {
120 120
         $value = $this->_get($key);
121 121
         if (isset($value)) {
122 122
             if (is_countable($value)) {
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      * @param string $key
140 140
      * @return bool
141 141
      */
142
-    protected function _is (string $key): bool {
142
+    protected function _is(string $key): bool {
143 143
         return !empty($this->_get($key));
144 144
     }
145 145
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      * @param mixed $value
153 153
      * @return $this
154 154
      */
155
-    protected function _set (string $key, $value) {
155
+    protected function _set(string $key, $value) {
156 156
         $this->data[$key] = $value;
157 157
         $this->diff[$key] = true;
158 158
         return $this;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      *
164 164
      * @param array $data
165 165
      */
166
-    protected function _setData (array $data): void {
166
+    protected function _setData(array $data): void {
167 167
         $this->data = $this->diff = [];
168 168
         foreach ($data as $key => $value) {
169 169
             $this->_setMapped($key, $value);
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
      * @param string $key
177 177
      * @param null|Data|array $value
178 178
      */
179
-    protected function _setMapped (string $key, $value): void {
179
+    protected function _setMapped(string $key, $value): void {
180 180
         unset($this->diff[$key]);
181 181
 
182 182
         // use unmapped values, null, [], Data, and Data[] as-is
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
      * @param array $data
217 217
      * @return mixed
218 218
      */
219
-    final protected function factory (string $class, array $data = []) {
219
+    final protected function factory(string $class, array $data = []) {
220 220
         return $this->api->factory($class, $this, $data);
221 221
     }
222 222
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
      *
226 226
      * @return array
227 227
      */
228
-    public function getDiff (): array {
228
+    public function getDiff(): array {
229 229
         $convert = function($each) use (&$convert) {
230 230
             // convert existing entities to gids
231 231
             if ($each instanceof AbstractEntity and $each->hasGid()) {
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
      *
251 251
      * @return bool
252 252
      */
253
-    final public function isDiff (): bool {
253
+    final public function isDiff(): bool {
254 254
         return (bool)$this->diff;
255 255
     }
256 256
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      * @see toArray()
259 259
      * @return array
260 260
      */
261
-    public function jsonSerialize (): array {
261
+    public function jsonSerialize(): array {
262 262
         return $this->toArray();
263 263
     }
264 264
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
      * @param array $query
273 273
      * @return null|mixed|AbstractEntity
274 274
      */
275
-    final protected function load (string $class, string $path, array $query = []) {
275
+    final protected function load(string $class, string $path, array $query = []) {
276 276
         return $this->api->load($class, $this, $path, $query);
277 277
     }
278 278
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
      * @param int $pages
288 288
      * @return array|AbstractEntity[]
289 289
      */
290
-    final protected function loadAll (string $class, string $path, array $query = [], int $pages = 0) {
290
+    final protected function loadAll(string $class, string $path, array $query = [], int $pages = 0) {
291 291
         return $this->api->loadAll($class, $this, $path, $query, $pages);
292 292
     }
293 293
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
      *
297 297
      * @return string
298 298
      */
299
-    public function serialize (): string {
299
+    public function serialize(): string {
300 300
         return serialize($this->toArray());
301 301
     }
302 302
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
      *
306 306
      * @return array
307 307
      */
308
-    public function toArray (): array {
308
+    public function toArray(): array {
309 309
         if (!$this->api) {
310 310
             return $this->data;
311 311
         }
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
      *
330 330
      * @param $serialized
331 331
      */
332
-    public function unserialize ($serialized): void {
332
+    public function unserialize($serialized): void {
333 333
         $this->api = Api::getDefault();
334 334
         $this->data = unserialize($serialized);
335 335
     }
Please login to merge, or discard this patch.
src/Portfolio.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,8 +73,7 @@
 block discarded – undo
73 73
         if ($this->hasGid()) {
74 74
             $this->api->post("{$this}/addMembers", ['members' => static::_getGids($users)]);
75 75
             $this->_merge('members', $users);
76
-        }
77
-        else {
76
+        } else {
78 77
             $this->_merge('members', $users, true);
79 78
         }
80 79
         return $this;
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
         'workspace' => Workspace::class
40 40
     ];
41 41
 
42
-    final public function __toString (): string {
42
+    final public function __toString(): string {
43 43
         return "portfolios/{$this->getGid()}";
44 44
     }
45 45
 
46
-    final protected function _getDir (): string {
46
+    final protected function _getDir(): string {
47 47
         return 'portfolios';
48 48
     }
49 49
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      * @param Project $item
53 53
      * @return $this
54 54
      */
55
-    public function addItem (Project $item) {
55
+    public function addItem(Project $item) {
56 56
         $this->api->post("{$this}/addItem", ['item' => $item->getGid()]);
57 57
         return $this;
58 58
     }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @param User $user
62 62
      * @return $this
63 63
      */
64
-    public function addMember (User $user) {
64
+    public function addMember(User $user) {
65 65
         return $this->addMembers([$user]);
66 66
     }
67 67
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      * @param User[] $users
70 70
      * @return $this
71 71
      */
72
-    public function addMembers (array $users) {
72
+    public function addMembers(array $users) {
73 73
         if ($this->hasGid()) {
74 74
             $this->api->post("{$this}/addMembers", ['members' => static::_getGids($users)]);
75 75
             $this->_merge('members', $users);
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      * @depends after-create
85 85
      * @return Project[]
86 86
      */
87
-    public function getItems () {
87
+    public function getItems() {
88 88
         return $this->loadAll(Project::class, "{$this}/items");
89 89
     }
90 90
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      * @param Project $item
94 94
      * @return $this
95 95
      */
96
-    public function removeItem (Project $item) {
96
+    public function removeItem(Project $item) {
97 97
         $this->api->post("{$this}/removeItem", ['item' => $item->getGid()]);
98 98
         return $this;
99 99
     }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      * @param User $user
103 103
      * @return $this
104 104
      */
105
-    public function removeMember (User $user) {
105
+    public function removeMember(User $user) {
106 106
         return $this->removeMembers([$user]);
107 107
     }
108 108
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      * @param User[] $users
111 111
      * @return $this
112 112
      */
113
-    public function removeMembers (array $users) {
113
+    public function removeMembers(array $users) {
114 114
         if ($this->hasGid()) {
115 115
             $this->api->post("{$this}/removeMembers", ['members' => static::_getGids($users)]);
116 116
         }
Please login to merge, or discard this patch.