Passed
Push — master ( 807e54...6d2916 )
by y
07:10
created
src/Base/Data.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * @param Api|Data $caller
47 47
      * @param array $data
48 48
      */
49
-    public function __construct ($caller, array $data = []) {
49
+    public function __construct($caller, array $data = []) {
50 50
         if ($caller instanceof self) {
51 51
             $this->api = $caller->api;
52 52
         }
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
      * @param array $args
70 70
      * @return mixed
71 71
      */
72
-    public function __call (string $method, array $args) {
72
+    public function __call(string $method, array $args) {
73 73
         static $magic = [];
74
-        if (!$call =& $magic[$method]) {
74
+        if (!$call = & $magic[$method]) {
75 75
             preg_match('/^(get|has|is|select|set)(.+)$/', $method, $call);
76 76
             if ('_select' !== $call[1] = '_' . $call[1]) { // _select() calls getters
77 77
                 $call[2] = preg_replace_callback('/[A-Z]/', function(array $match) {
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      * @return array
87 87
      * @internal pool, `var_export()`
88 88
      */
89
-    final public function __debugInfo (): array {
89
+    final public function __debugInfo(): array {
90 90
         return $this->data;
91 91
     }
92 92
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      * @return null|Data|mixed
96 96
      * @internal for `array_column()`
97 97
      */
98
-    final public function __get ($field) {
98
+    final public function __get($field) {
99 99
         return $this->_get($field);
100 100
     }
101 101
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      * @return bool
105 105
      * @internal for `array_column()`
106 106
      */
107
-    final public function __isset ($field) {
107
+    final public function __isset($field) {
108 108
         return true; // fields may be lazy-loaded or coalesced to null.
109 109
     }
110 110
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      * @param string $field
117 117
      * @return mixed
118 118
      */
119
-    protected function _get (string $field) {
119
+    protected function _get(string $field) {
120 120
         return $this->data[$field] ?? null;
121 121
     }
122 122
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      * @param string $field
132 132
      * @return bool
133 133
      */
134
-    protected function _has (string $field): bool {
134
+    protected function _has(string $field): bool {
135 135
         $value = $this->_get($field);
136 136
         if (isset($value)) {
137 137
             if (is_countable($value)) {
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      * @param mixed $item
150 150
      * @return mixed
151 151
      */
152
-    protected function _hydrate (string $class, $item) {
152
+    protected function _hydrate(string $class, $item) {
153 153
         if (!isset($item) or $item instanceof self) {
154 154
             return $item;
155 155
         }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      * @param string $field
179 179
      * @return bool
180 180
      */
181
-    protected function _is (string $field): bool {
181
+    protected function _is(string $field): bool {
182 182
         return (bool)$this->_get($field);
183 183
     }
184 184
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
      * @param array $args
197 197
      * @return array
198 198
      */
199
-    protected function _select ($subject, callable $filter, ...$args) {
199
+    protected function _select($subject, callable $filter, ...$args) {
200 200
         if (is_string($subject)) {
201 201
             $subject = $this->{'get' . $subject}(...$args) ?? [];
202 202
         }
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
      * @param mixed $value
219 219
      * @return $this
220 220
      */
221
-    protected function _set (string $field, $value) {
221
+    protected function _set(string $field, $value) {
222 222
         $this->data[$field] = $value;
223 223
         $this->diff[$field] = true;
224 224
         return $this;
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      *
230 230
      * @param array $data
231 231
      */
232
-    protected function _setData (array $data): void {
232
+    protected function _setData(array $data): void {
233 233
         $this->data = $this->diff = [];
234 234
         foreach ($data as $field => $value) {
235 235
             $this->_setField($field, $value);
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
      * @param string $field
243 243
      * @param mixed $value
244 244
      */
245
-    protected function _setField (string $field, $value): void {
245
+    protected function _setField(string $field, $value): void {
246 246
         if (isset(static::MAP[$field])) {
247 247
             $class = static::MAP[$field];
248 248
             if (is_array($class)) {
@@ -263,14 +263,14 @@  discard block
 block discarded – undo
263 263
      *
264 264
      * @return bool
265 265
      */
266
-    final public function isDiff (): bool {
266
+    final public function isDiff(): bool {
267 267
         return (bool)$this->diff;
268 268
     }
269 269
 
270 270
     /**
271 271
      * @return array
272 272
      */
273
-    public function jsonSerialize (): array {
273
+    public function jsonSerialize(): array {
274 274
         $data = $this->toArray();
275 275
         ksort($data);
276 276
         return $data;
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
      *
282 282
      * @return string
283 283
      */
284
-    public function serialize (): string {
285
-        return json_encode($this, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
284
+    public function serialize(): string {
285
+        return json_encode($this, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE);
286 286
     }
287 287
 
288 288
     /**
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
      * @param bool $diff
292 292
      * @return array
293 293
      */
294
-    public function toArray (bool $diff = false): array {
294
+    public function toArray(bool $diff = false): array {
295 295
         $dehydrate = function($each) use (&$dehydrate, $diff) {
296 296
             // convert entities to gids
297 297
             if ($each instanceof AbstractEntity and $each->hasGid()) {
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
     /**
318 318
      * @param $serialized
319 319
      */
320
-    public function unserialize ($serialized): void {
320
+    public function unserialize($serialized): void {
321 321
         $this->data = json_decode($serialized, true);
322 322
     }
323 323
 }
324 324
\ No newline at end of file
Please login to merge, or discard this patch.
src/Base/AbstractEntity/PostMutatorTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
      * @param array $diff
20 20
      * @return $this
21 21
      */
22
-    private function _addWithPost (string $addPath, array $data, string $field, array $diff) {
22
+    private function _addWithPost(string $addPath, array $data, string $field, array $diff) {
23 23
         if ($this->hasGid()) {
24 24
             return $this->_setWithPost($addPath, $data, $field);
25 25
         }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param array|Closure $diff An array to diff, or a filter closure.
34 34
      * @return $this
35 35
      */
36
-    private function _removeWithPost (string $rmPath, array $data, string $field, $diff) {
36
+    private function _removeWithPost(string $rmPath, array $data, string $field, $diff) {
37 37
         if ($this->hasGid()) {
38 38
             return $this->_setWithPost($rmPath, $data, $field);
39 39
         }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @return $this
54 54
      * @internal
55 55
      */
56
-    private function _setWithPost (string $path, array $data, string $field, $value = null) {
56
+    private function _setWithPost(string $path, array $data, string $field, $value = null) {
57 57
         if ($this->hasGid()) {
58 58
             /** @var array $remote */
59 59
             $remote = $this->api->post($path, $data, ['fields' => static::OPT_FIELDS[$field] ?? $field]);
Please login to merge, or discard this patch.
src/Event/Change.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      */
41 41
     protected $key;
42 42
 
43
-    protected function _setData (array $data): void {
43
+    protected function _setData(array $data): void {
44 44
         $this->key = [
45 45
             Event::ACTION_ADDED => 'added_value',
46 46
             Event::ACTION_REMOVED => 'removed_value',
@@ -67,35 +67,35 @@  discard block
 block discarded – undo
67 67
      *
68 68
      * @return null|User|Project|Section|Task|FieldEntry|Attachment|Story|Like
69 69
      */
70
-    public function getPayload () {
70
+    public function getPayload() {
71 71
         return $this->data[$this->key];
72 72
     }
73 73
 
74 74
     /**
75 75
      * @return bool
76 76
      */
77
-    final public function hasPayload (): bool {
77
+    final public function hasPayload(): bool {
78 78
         return isset($this->data[$this->key]);
79 79
     }
80 80
 
81 81
     /**
82 82
      * @return bool
83 83
      */
84
-    final public function wasAddition (): bool {
84
+    final public function wasAddition(): bool {
85 85
         return $this->getAction() === Event::ACTION_ADDED;
86 86
     }
87 87
 
88 88
     /**
89 89
      * @return bool
90 90
      */
91
-    final public function wasRemoval (): bool {
91
+    final public function wasRemoval(): bool {
92 92
         return $this->getAction() === Event::ACTION_REMOVED;
93 93
     }
94 94
 
95 95
     /**
96 96
      * @return bool
97 97
      */
98
-    final public function wasValue (): bool {
98
+    final public function wasValue(): bool {
99 99
         return $this->getAction() === Event::ACTION_CHANGED;
100 100
     }
101 101
 
Please login to merge, or discard this patch.
src/Base/AbstractEntity/SyncTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
      * @param null|string $token Updated to the new token.
25 25
      * @return Event[]
26 26
      */
27
-    public function getEvents (?string &$token) {
27
+    public function getEvents(?string &$token) {
28 28
         try {
29 29
             /** @var array $remote Asana throws 400 for missing entities. */
30 30
             $remote = $this->api->call('GET', 'events?' . http_build_query([
Please login to merge, or discard this patch.
src/Job.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      *
41 41
      * @return bool
42 42
      */
43
-    final public function isActive (): bool {
43
+    final public function isActive(): bool {
44 44
         return $this->getStatus() === self::STATUS_ACTIVE;
45 45
     }
46 46
 
@@ -49,21 +49,21 @@  discard block
 block discarded – undo
49 49
      *
50 50
      * @return bool
51 51
      */
52
-    final public function isDone (): bool {
52
+    final public function isDone(): bool {
53 53
         return $this->isSuccessful() or $this->isFailed();
54 54
     }
55 55
 
56 56
     /**
57 57
      * @return bool
58 58
      */
59
-    final public function isDuplicatingProject (): bool {
59
+    final public function isDuplicatingProject(): bool {
60 60
         return $this->getResourceSubtype() === self::TYPE_DUPLICATE_PROJECT;
61 61
     }
62 62
 
63 63
     /**
64 64
      * @return bool
65 65
      */
66
-    final public function isDuplicatingTask (): bool {
66
+    final public function isDuplicatingTask(): bool {
67 67
         return $this->getResourceSubtype() === self::TYPE_DUPLICATE_TASK;
68 68
     }
69 69
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      *
73 73
      * @return bool
74 74
      */
75
-    final public function isFailed (): bool {
75
+    final public function isFailed(): bool {
76 76
         return $this->getStatus() === self::STATUS_FAIL;
77 77
     }
78 78
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      *
82 82
      * @return bool
83 83
      */
84
-    final public function isQueued (): bool {
84
+    final public function isQueued(): bool {
85 85
         return $this->getStatus() === self::STATUS_QUEUED;
86 86
     }
87 87
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @return bool
92 92
      */
93
-    final public function isSuccessful (): bool {
93
+    final public function isSuccessful(): bool {
94 94
         return $this->getStatus() === self::STATUS_SUCCESS;
95 95
     }
96 96
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      * @param callable $spinner `fn( Job $this ): void`
103 103
      * @return $this
104 104
      */
105
-    public function wait (callable $spinner = null) {
105
+    public function wait(callable $spinner = null) {
106 106
         while (!$this->isDone()) {
107 107
             if ($spinner) {
108 108
                 call_user_func($spinner, $this);
Please login to merge, or discard this patch.
src/User/TaskList.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
      * @param array $filter
37 37
      * @return Traversable|Task[]
38 38
      */
39
-    public function getIterator (array $filter = Task::GET_INCOMPLETE) {
39
+    public function getIterator(array $filter = Task::GET_INCOMPLETE) {
40 40
         return $this->api->loadEach($this, Task::class, "{$this}/tasks", $filter);
41 41
     }
42 42
 
43
-    public function getPoolKeys () {
43
+    public function getPoolKeys() {
44 44
         $keys = parent::getPoolKeys();
45 45
 
46 46
         /** @see User::getTaskList() */
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      * @param array $filter
58 58
      * @return Task[]
59 59
      */
60
-    public function getTasks (array $filter = Task::GET_INCOMPLETE) {
60
+    public function getTasks(array $filter = Task::GET_INCOMPLETE) {
61 61
         return iterator_to_array($this->getIterator($filter));
62 62
     }
63 63
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      * @param array $apiFilter Given to the API to reduce network load.
67 67
      * @return Task[]
68 68
      */
69
-    public function selectTasks (callable $filter, array $apiFilter = Task::GET_INCOMPLETE) {
69
+    public function selectTasks(callable $filter, array $apiFilter = Task::GET_INCOMPLETE) {
70 70
         return $this->_select($this->getIterator($apiFilter), $filter);
71 71
     }
72 72
 }
73 73
\ No newline at end of file
Please login to merge, or discard this patch.
src/Tag.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      * @param array $filter
44 44
      * @return Traversable|Task[]
45 45
      */
46
-    public function getIterator (array $filter = Task::GET_INCOMPLETE) {
46
+    public function getIterator(array $filter = Task::GET_INCOMPLETE) {
47 47
         return $this->api->loadEach($this, Task::class, "{$this}/tasks", $filter);
48 48
     }
49 49
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      * @param array $filter
52 52
      * @return Task[]
53 53
      */
54
-    public function getTasks (array $filter = Task::GET_INCOMPLETE) {
54
+    public function getTasks(array $filter = Task::GET_INCOMPLETE) {
55 55
         return iterator_to_array($this->getIterator($filter));
56 56
     }
57 57
 }
58 58
\ No newline at end of file
Please login to merge, or discard this patch.
src/Api/AsanaError.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      * @param string $message
27 27
      * @param array $curlInfo
28 28
      */
29
-    public function __construct (int $code, string $message, array $curlInfo) {
29
+    public function __construct(int $code, string $message, array $curlInfo) {
30 30
         parent::__construct($message, $code);
31 31
         $this->curlInfo = $curlInfo;
32 32
     }
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
      *
37 37
      * @return array
38 38
      */
39
-    public function asResponse () {
40
-        return json_decode($this->getMessage(), true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR);
39
+    public function asResponse() {
40
+        return json_decode($this->getMessage(), true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR);
41 41
     }
42 42
 
43 43
     /**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      *
46 46
      * @return array
47 47
      */
48
-    final public function getCurlInfo (): array {
48
+    final public function getCurlInfo(): array {
49 49
         return $this->curlInfo;
50 50
     }
51 51
 
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
      * @param int $code
54 54
      * @return bool
55 55
      */
56
-    final public function is (int $code): bool {
56
+    final public function is(int $code): bool {
57 57
         return $this->code === $code;
58 58
     }
59 59
 
60 60
     /**
61 61
      * @return bool
62 62
      */
63
-    final public function isCurl (): bool {
63
+    final public function isCurl(): bool {
64 64
         return $this->code < 400;
65 65
     }
66 66
 }
67 67
\ No newline at end of file
Please login to merge, or discard this patch.
src/Api/Pool.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     /**
30 30
      * @param AbstractEntity $entity
31 31
      */
32
-    protected function _add (AbstractEntity $entity): void {
32
+    protected function _add(AbstractEntity $entity): void {
33 33
         assert($entity->hasGid());
34 34
         $gid = $entity->getGid();
35 35
         $this->entities[$gid] = $entity;
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      * @param AbstractEntity $entity
41 41
      * @param string[] $keys
42 42
      */
43
-    protected function _addKeys (AbstractEntity $entity, ...$keys): void {
43
+    protected function _addKeys(AbstractEntity $entity, ...$keys): void {
44 44
         assert($entity->hasGid());
45 45
         $this->gids += array_fill_keys($keys, $entity->getGid());
46 46
     }
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      * @param Api|Data $caller For hydration if needed.
51 51
      * @return null|AbstractEntity
52 52
      */
53
-    protected function _get (string $key, $caller) {
53
+    protected function _get(string $key, $caller) {
54 54
         if (isset($this->gids[$key])) {
55 55
             return $this->entities[$this->gids[$key]];
56 56
         }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      * @param string $key
65 65
      * @return bool
66 66
      */
67
-    protected function _has (string $key): bool {
67
+    protected function _has(string $key): bool {
68 68
         return isset($this->gids[$key]);
69 69
     }
70 70
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      *
76 76
      * @param AbstractEntity $entity
77 77
      */
78
-    final public function add (AbstractEntity $entity): void {
78
+    final public function add(AbstractEntity $entity): void {
79 79
         assert($entity->hasGid());
80 80
         if (!$entity->isDiff()) {
81 81
             $this->_add($entity);
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      * @param Closure $factory `fn( Api|Data $caller ): null|AbstractEntity`
94 94
      * @return null|mixed|AbstractEntity
95 95
      */
96
-    final public function get (string $key, $caller, Closure $factory) {
96
+    final public function get(string $key, $caller, Closure $factory) {
97 97
         /** @var AbstractEntity $entity */
98 98
         if (!$entity = $this->_get($key, $caller) and $entity = $factory($caller)) {
99 99
             $gid = $entity->getGid();
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     /**
115 115
      * @param string[] $keys
116 116
      */
117
-    public function remove (array $keys): void {
117
+    public function remove(array $keys): void {
118 118
         foreach ($keys as $key) {
119 119
             unset($this->entities[$key]);
120 120
             unset($this->gids[$key]);
Please login to merge, or discard this patch.