Passed
Push — master ( 24e1a2...15b43b )
by y
01:43
created
src/Project/Section.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
         'project' => Project::class
31 31
     ];
32 32
 
33
-    final public function __toString (): string {
33
+    final public function __toString(): string {
34 34
         return "sections/{$this->getGid()}";
35 35
     }
36 36
 
37
-    final protected function _getDir (): string {
37
+    final protected function _getDir(): string {
38 38
         return "{$this->getProject()}/sections";
39 39
     }
40 40
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      * @param array $filter
43 43
      * @return Traversable|Task[]
44 44
      */
45
-    public function getIterator (array $filter = Task::FILTER_INCOMPLETE) {
45
+    public function getIterator(array $filter = Task::FILTER_INCOMPLETE) {
46 46
         $filter['section'] = $this->getGid();
47 47
         return $this->api->loadEach($this, Task::class, 'tasks', $filter);
48 48
     }
@@ -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::FILTER_INCOMPLETE) {
54
+    public function getTasks(array $filter = Task::FILTER_INCOMPLETE) {
55 55
         return iterator_to_array($this->getIterator($filter));
56 56
     }
57 57
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @depends after-create
62 62
      * @return Task
63 63
      */
64
-    public function newTask () {
64
+    public function newTask() {
65 65
         /** @var Task $task */
66 66
         $task = $this->api->factory($this, Task::class);
67 67
         return $task->addToProject($this);
Please login to merge, or discard this patch.
src/Event/Change.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      */
29 29
     protected $valueKey;
30 30
 
31
-    protected function _setData (array $data): void {
31
+    protected function _setData(array $data): void {
32 32
         $this->valueKey = [
33 33
             'added' => 'added_value',
34 34
             'removed' => 'removed_value',
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
      *
55 55
      * @return null|User|Project|Section|Task|FieldEntry|Attachment|Story|Like
56 56
      */
57
-    public function getPayload () {
57
+    public function getPayload() {
58 58
         return $this->data[$this->valueKey];
59 59
     }
60 60
 
61 61
     /**
62 62
      * @return bool
63 63
      */
64
-    final public function hasPayload (): bool {
64
+    final public function hasPayload(): bool {
65 65
         return isset($this->data[$this->valueKey]);
66 66
     }
67 67
 
Please login to merge, or discard this patch.
src/Base/Data.php 2 patches
Spacing   +21 added lines, -21 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
         }
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
      * @param array $args
68 68
      * @return mixed
69 69
      */
70
-    public function __call (string $method, array $args) {
70
+    public function __call(string $method, array $args) {
71 71
         static $magic = [];
72
-        if (!$call =& $magic[$method]) {
72
+        if (!$call = & $magic[$method]) {
73 73
             preg_match('/^(get|has|is|select|set)(.+)$/', $method, $call);
74 74
             $call[1] = '_' . $call[1];
75 75
             $call[2] = preg_replace_callback('/[A-Z]/', function(array $match) {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     /**
83 83
      * @return array
84 84
      */
85
-    public function __debugInfo (): array {
85
+    public function __debugInfo(): array {
86 86
         return $this->data;
87 87
     }
88 88
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      * @return null|Data|mixed
92 92
      * @internal `array_column()`
93 93
      */
94
-    final public function __get ($field) {
94
+    final public function __get($field) {
95 95
         return $this->_get($field);
96 96
     }
97 97
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      * @return bool
101 101
      * @internal `array_column()`
102 102
      */
103
-    final public function __isset ($field) {
103
+    final public function __isset($field) {
104 104
         return true;
105 105
     }
106 106
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      * @param string $field
113 113
      * @return mixed
114 114
      */
115
-    protected function _get (string $field) {
115
+    protected function _get(string $field) {
116 116
         return $this->data[$field] ?? null;
117 117
     }
118 118
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      * @param string $field
128 128
      * @return bool
129 129
      */
130
-    protected function _has (string $field): bool {
130
+    protected function _has(string $field): bool {
131 131
         $value = $this->_get($field);
132 132
         if (isset($value)) {
133 133
             if (is_countable($value)) {
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      * @param mixed $item
146 146
      * @return mixed
147 147
      */
148
-    protected function _hydrate (string $class, $item) {
148
+    protected function _hydrate(string $class, $item) {
149 149
         if (!isset($item) or $item instanceof self) {
150 150
             return $item;
151 151
         }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      * @param string $field
175 175
      * @return bool
176 176
      */
177
-    protected function _is (string $field): bool {
177
+    protected function _is(string $field): bool {
178 178
         return (bool)$this->_get($field);
179 179
     }
180 180
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      * @param callable $filter `fn( Data $object ): bool`
190 190
      * @return array
191 191
      */
192
-    protected function _select ($subject, callable $filter) {
192
+    protected function _select($subject, callable $filter) {
193 193
         if (is_string($subject)) {
194 194
             $subject = $this->_get($subject) ?? [];
195 195
         }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
      * @param mixed $value
212 212
      * @return $this
213 213
      */
214
-    protected function _set (string $field, $value) {
214
+    protected function _set(string $field, $value) {
215 215
         $this->data[$field] = $value;
216 216
         $this->diff[$field] = true;
217 217
         return $this;
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
      *
223 223
      * @param array $data
224 224
      */
225
-    protected function _setData (array $data): void {
225
+    protected function _setData(array $data): void {
226 226
         $this->data = $this->diff = [];
227 227
         foreach ($data as $field => $value) {
228 228
             $this->_setField($field, $value);
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      * @param string $field
236 236
      * @param mixed $value
237 237
      */
238
-    protected function _setField (string $field, $value): void {
238
+    protected function _setField(string $field, $value): void {
239 239
         if (isset(static::MAP[$field])) {
240 240
             $class = static::MAP[$field];
241 241
             if (is_array($class)) {
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      *
257 257
      * @return array
258 258
      */
259
-    public function getDiff (): array {
259
+    public function getDiff(): array {
260 260
         $convert = function($each) use (&$convert) {
261 261
             // convert existing entities to gids
262 262
             if ($each instanceof AbstractEntity and $each->hasGid()) {
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
      *
282 282
      * @return bool
283 283
      */
284
-    final public function isDiff (): bool {
284
+    final public function isDiff(): bool {
285 285
         return (bool)$this->diff;
286 286
     }
287 287
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
      * @see toArray()
290 290
      * @return array
291 291
      */
292
-    public function jsonSerialize (): array {
292
+    public function jsonSerialize(): array {
293 293
         $data = $this->toArray();
294 294
         ksort($data);
295 295
         return $data;
@@ -300,8 +300,8 @@  discard block
 block discarded – undo
300 300
      *
301 301
      * @return string
302 302
      */
303
-    public function serialize (): string {
304
-        return json_encode($this, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
303
+    public function serialize(): string {
304
+        return json_encode($this, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE);
305 305
     }
306 306
 
307 307
     /**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
      *
310 310
      * @return array
311 311
      */
312
-    public function toArray (): array {
312
+    public function toArray(): array {
313 313
         if (!$this->api) {
314 314
             return $this->data;
315 315
         }
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
     /**
335 335
      * @param $serialized
336 336
      */
337
-    public function unserialize ($serialized): void {
337
+    public function unserialize($serialized): void {
338 338
         $this->data = json_decode($serialized, true);
339 339
     }
340 340
 }
341 341
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,8 +49,7 @@  discard block
 block discarded – undo
49 49
     public function __construct ($caller, array $data = []) {
50 50
         if ($caller instanceof self) {
51 51
             $this->api = $caller->api;
52
-        }
53
-        else {
52
+        } else {
54 53
             $this->api = $caller;
55 54
         }
56 55
         $this->_setData($data);
@@ -242,8 +241,7 @@  discard block
 block discarded – undo
242 241
                 $value = array_map(function($each) use ($class) {
243 242
                     return $this->_hydrate($class[0], $each);
244 243
                 }, $value);
245
-            }
246
-            elseif (isset($value)) {
244
+            } elseif (isset($value)) {
247 245
                 $value = $this->_hydrate($class, $value);
248 246
             }
249 247
         }
Please login to merge, or discard this patch.
src/Base/AbstractEntity.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
      *
32 32
      * @return string
33 33
      */
34
-    abstract public function __toString (): string;
34
+    abstract public function __toString(): string;
35 35
 
36 36
     /**
37 37
      * @param self $entity
38 38
      * @return bool
39 39
      * @internal pool
40 40
      */
41
-    final public function __merge (self $entity): bool {
41
+    final public function __merge(self $entity): bool {
42 42
         $old = $this->toArray();
43 43
         $this->data = array_merge($this->data, array_diff_key($entity->data, $this->diff));
44 44
         return $this->toArray() !== $old;
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      * @return $this
53 53
      * @internal
54 54
      */
55
-    protected function _addWithPost (string $addPath, array $data, string $field, array $diff) {
55
+    protected function _addWithPost(string $addPath, array $data, string $field, array $diff) {
56 56
         if ($this->hasGid()) {
57 57
             return $this->_setWithPost($addPath, $data, $field);
58 58
         }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      * @param string $field
66 66
      * @return mixed
67 67
      */
68
-    protected function _get (string $field) {
68
+    protected function _get(string $field) {
69 69
         if (!array_key_exists($field, $this->data) and $this->hasGid()) {
70 70
             $this->_reload($field);
71 71
         }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     /**
76 76
      * @param string $field
77 77
      */
78
-    protected function _reload (string $field): void {
78
+    protected function _reload(string $field): void {
79 79
         $remote = $this->api->get($this, [], ['fields' => static::OPT_FIELDS[$field] ?? $field]);
80 80
         $this->_setField($field, $remote[$field] ?? null);
81 81
         $this->api->getPool()->add($this);
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      * @return $this
90 90
      * @internal
91 91
      */
92
-    protected function _removeWithPost (string $rmPath, array $data, string $field, $diff) {
92
+    protected function _removeWithPost(string $rmPath, array $data, string $field, $diff) {
93 93
         if ($this->hasGid()) {
94 94
             return $this->_setWithPost($rmPath, $data, $field);
95 95
         }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         return $this->_set($field, array_values(array_filter($this->data[$field] ?? [], $diff)));
100 100
     }
101 101
 
102
-    protected function _setData (array $data): void {
102
+    protected function _setData(array $data): void {
103 103
         // make sure the gid is consistently null|string across all entities.
104 104
         $data['gid'] = (string)$data['gid'];
105 105
         if (empty($data['gid'])) {
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      * @return $this
123 123
      * @internal
124 124
      */
125
-    protected function _setWithPost (string $path, array $data, string $field, $value = null) {
125
+    protected function _setWithPost(string $path, array $data, string $field, $value = null) {
126 126
         if ($this->hasGid()) {
127 127
             /** @var array $remote */
128 128
             $remote = $this->api->post($path, $data, ['fields' => static::OPT_FIELDS[$field] ?? $field]);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     /**
139 139
      * @return null|string
140 140
      */
141
-    final public function getGid (): ?string {
141
+    final public function getGid(): ?string {
142 142
         return $this->data['gid'];
143 143
     }
144 144
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      *
148 148
      * @return string[]
149 149
      */
150
-    public function getPoolKeys () {
150
+    public function getPoolKeys() {
151 151
         return [$this->getGid(), (string)$this];
152 152
     }
153 153
 
@@ -156,14 +156,14 @@  discard block
 block discarded – undo
156 156
      *
157 157
      * @return string
158 158
      */
159
-    final public function getResourceType (): string {
159
+    final public function getResourceType(): string {
160 160
         return $this::TYPE;
161 161
     }
162 162
 
163 163
     /**
164 164
      * @return bool
165 165
      */
166
-    final public function hasGid (): bool {
166
+    final public function hasGid(): bool {
167 167
         return isset($this->data['gid']);
168 168
     }
169 169
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
      * @depends after-create
174 174
      * @return $this
175 175
      */
176
-    public function reload () {
176
+    public function reload() {
177 177
         $remote = $this->api->get($this, [], ['expand' => 'this']);
178 178
         if (!isset($remote['gid'])) { // null and dir guard
179 179
             $this->api->getPool()->remove($this->getPoolKeys());
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,8 +92,7 @@
 block discarded – undo
92 92
     protected function _removeWithPost (string $rmPath, array $data, string $field, $diff) {
93 93
         if ($this->hasGid()) {
94 94
             return $this->_setWithPost($rmPath, $data, $field);
95
-        }
96
-        elseif (is_array($diff)) {
95
+        } elseif (is_array($diff)) {
97 96
             return $this->_set($field, array_values(array_diff($this->data[$field] ?? [], $diff)));
98 97
         }
99 98
         return $this->_set($field, array_values(array_filter($this->data[$field] ?? [], $diff)));
Please login to merge, or discard this patch.
src/Task/FieldEntries.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     protected $types = [];
51 51
 
52
-    public function __construct (Task $task, array $data = []) {
52
+    public function __construct(Task $task, array $data = []) {
53 53
         $this->task = $task;
54 54
         parent::__construct($task, $data);
55 55
     }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @param string $i
59 59
      * @param array $data
60 60
      */
61
-    protected function _setField (string $i, $data): void {
61
+    protected function _setField(string $i, $data): void {
62 62
         /** @var FieldEntry $entry */
63 63
         $entry = $this->api->factory($this, FieldEntry::class, $data);
64 64
         $gid = $entry->getGid();
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * @param $offset
73 73
      * @return null|string
74 74
      */
75
-    protected function _toGid (string $offset) {
75
+    protected function _toGid(string $offset) {
76 76
         if (isset($this->names[$offset])) {
77 77
             return $offset;
78 78
         }
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
     /**
83 83
      * @return int
84 84
      */
85
-    public function count () {
85
+    public function count() {
86 86
         return count($this->data);
87 87
     }
88 88
 
89
-    public function getDiff (): array {
89
+    public function getDiff(): array {
90 90
         return array_map(function(FieldEntry $value) {
91 91
             return $value->getValue();
92 92
         }, array_intersect_key($this->data, $this->diff));
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      * @param $fieldGid
97 97
      * @return FieldEntry
98 98
      */
99
-    public function getField ($fieldGid) {
99
+    public function getField($fieldGid) {
100 100
         return $this->data[$fieldGid];
101 101
     }
102 102
 
@@ -104,41 +104,41 @@  discard block
 block discarded – undo
104 104
      * @param string $name
105 105
      * @return string
106 106
      */
107
-    public function getGid (string $name): string {
107
+    public function getGid(string $name): string {
108 108
         return $this->gids[$name];
109 109
     }
110 110
 
111 111
     /**
112 112
      * @return string[]
113 113
      */
114
-    public function getGids () {
114
+    public function getGids() {
115 115
         return $this->gids;
116 116
     }
117 117
 
118 118
     /**
119 119
      * @return Generator
120 120
      */
121
-    public function getIterator () {
121
+    public function getIterator() {
122 122
         foreach ($this->data as $gid => $field) {
123 123
             yield $gid => $field->getValue();
124 124
         }
125 125
     }
126 126
 
127
-    public function getName (string $fieldGid) {
127
+    public function getName(string $fieldGid) {
128 128
         return $this->names[$fieldGid];
129 129
     }
130 130
 
131 131
     /**
132 132
      * @return string[]
133 133
      */
134
-    public function getNames () {
134
+    public function getNames() {
135 135
         return $this->names;
136 136
     }
137 137
 
138 138
     /**
139 139
      * @return array
140 140
      */
141
-    public function getValues () {
141
+    public function getValues() {
142 142
         return iterator_to_array($this);
143 143
     }
144 144
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      * @param string $offset
147 147
      * @return bool
148 148
      */
149
-    public function offsetExists ($offset) {
149
+    public function offsetExists($offset) {
150 150
         return isset($this->data[$this->_toGid($offset)]);
151 151
     }
152 152
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      * @param string $offset
155 155
      * @return null|number|string
156 156
      */
157
-    public function offsetGet ($offset) {
157
+    public function offsetGet($offset) {
158 158
         return $this->data[$this->_toGid($offset)]->getValue();
159 159
     }
160 160
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      * @param string $offset
163 163
      * @param null|number|string $value
164 164
      */
165
-    public function offsetSet ($offset, $value) {
165
+    public function offsetSet($offset, $value) {
166 166
         $offset = $this->_toGid($offset);
167 167
         $this->data[$offset]->setValue($value);
168 168
         $this->diff[$offset] = true;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      *
175 175
      * @param string $offset
176 176
      */
177
-    public function offsetUnset ($offset) {
177
+    public function offsetUnset($offset) {
178 178
         $this->offsetSet($offset, null);
179 179
     }
180 180
 
Please login to merge, or discard this patch.
src/User.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         'workspaces' => [Workspace::class]
30 30
     ];
31 31
 
32
-    final public function __toString (): string {
32
+    final public function __toString(): string {
33 33
         return "users/{$this->getGid()}";
34 34
     }
35 35
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      * @param Workspace $workspace
38 38
      * @return $this
39 39
      */
40
-    public function addToWorkspace (Workspace $workspace) {
40
+    public function addToWorkspace(Workspace $workspace) {
41 41
         return $this->_addWithPost("{$workspace}/addUser", [
42 42
             'user' => $this->getGid()
43 43
         ], 'workspaces', [$workspace]);
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      *
50 50
      * @return Workspace
51 51
      */
52
-    public function getDefaultWorkspace () {
52
+    public function getDefaultWorkspace() {
53 53
         return $this->getWorkspaces()[0];
54 54
     }
55 55
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      * @param null|Workspace $workspace Falls back to the default workspace.
58 58
      * @return Portfolio[]
59 59
      */
60
-    public function getFavoritePortfolios (Workspace $workspace = null) {
60
+    public function getFavoritePortfolios(Workspace $workspace = null) {
61 61
         return $this->getFavorites(Portfolio::class, Portfolio::TYPE, $workspace);
62 62
     }
63 63
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      * @param null|Workspace $workspace Falls back to the default workspace.
66 66
      * @return Project[]
67 67
      */
68
-    public function getFavoriteProjects (Workspace $workspace = null) {
68
+    public function getFavoriteProjects(Workspace $workspace = null) {
69 69
         return $this->getFavorites(Project::class, Project::TYPE, $workspace);
70 70
     }
71 71
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      * @param null|Workspace $workspace Falls back to the default workspace.
74 74
      * @return Tag[]
75 75
      */
76
-    public function getFavoriteTags (Workspace $workspace = null) {
76
+    public function getFavoriteTags(Workspace $workspace = null) {
77 77
         return $this->getFavorites(Tag::class, Tag::TYPE, $workspace);
78 78
     }
79 79
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      * @param null|Workspace $workspace Falls back to the default workspace.
82 82
      * @return Team[]
83 83
      */
84
-    public function getFavoriteTeams (Workspace $workspace = null) {
84
+    public function getFavoriteTeams(Workspace $workspace = null) {
85 85
         return $this->getFavorites(Team::class, Team::TYPE, $workspace);
86 86
     }
87 87
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      * @param null|Workspace $workspace Falls back to the default workspace.
90 90
      * @return User[]
91 91
      */
92
-    public function getFavoriteUsers (Workspace $workspace = null) {
92
+    public function getFavoriteUsers(Workspace $workspace = null) {
93 93
         return $this->getFavorites(self::class, self::TYPE, $workspace);
94 94
     }
95 95
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      * @param null|Workspace $workspace Falls back to the default workspace.
100 100
      * @return array
101 101
      */
102
-    protected function getFavorites (string $class, string $resourceType, Workspace $workspace = null) {
102
+    protected function getFavorites(string $class, string $resourceType, Workspace $workspace = null) {
103 103
         return $this->api->loadAll($this, $class, "{$this}/favorites", [
104 104
             'resource_type' => $resourceType,
105 105
             'workspace' => ($workspace ?? $this->api->getDefaultWorkspace())->getGid()
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     /**
110 110
      * @return string[]
111 111
      */
112
-    public function getPoolKeys () {
112
+    public function getPoolKeys() {
113 113
         $keys = parent::getPoolKeys();
114 114
 
115 115
         // include email as a key if it's loaded
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      * @param null|Workspace $workspace
125 125
      * @return Portfolio[]
126 126
      */
127
-    public function getPortfolios (Workspace $workspace = null) {
127
+    public function getPortfolios(Workspace $workspace = null) {
128 128
         return $this->api->loadAll($this, Portfolio::class, "portfolios", [
129 129
             'workspace' => ($workspace ?? $this->api->getDefaultWorkspace())->getGid(),
130 130
             'owner' => $this->getGid()
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      * @param null|Workspace $workspace Falls back to the default workspace.
136 136
      * @return TaskList
137 137
      */
138
-    public function getTaskList (Workspace $workspace = null) {
138
+    public function getTaskList(Workspace $workspace = null) {
139 139
         return $this->api->load($this, TaskList::class, "{$this}/user_task_list", [
140 140
             'workspace' => ($workspace ?? $this->api->getDefaultWorkspace())->getGid()
141 141
         ]);
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      * @param string[] $filter `workspace` falls back to the default.
148 148
      * @return Task[]
149 149
      */
150
-    public function getTasks (array $filter = Task::FILTER_INCOMPLETE) {
150
+    public function getTasks(array $filter = Task::FILTER_INCOMPLETE) {
151 151
         $filter['assignee'] = $this->getGid();
152 152
         $filter += ['workspace' => $this->api->getDefaultWorkspace()->getGid()];
153 153
         return $this->api->loadAll($this, Task::class, 'tasks', $filter);
@@ -161,13 +161,13 @@  discard block
 block discarded – undo
161 161
      * @param null|Workspace $organization Falls back to the default workspace.
162 162
      * @return Team[]
163 163
      */
164
-    public function getTeams (Workspace $organization = null) {
164
+    public function getTeams(Workspace $organization = null) {
165 165
         return $this->api->loadAll($this, Team::class, "{$this}/teams", [
166 166
             'organization' => ($organization ?? $this->getDefaultWorkspace())->getGid()
167 167
         ]);
168 168
     }
169 169
 
170
-    public function getUrl (): string {
170
+    public function getUrl(): string {
171 171
         return "https://app.asana.com/0/{$this->getGid()}/list";
172 172
     }
173 173
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      * @param Workspace $workspace
176 176
      * @return $this
177 177
      */
178
-    public function removeFromWorkspace (Workspace $workspace) {
178
+    public function removeFromWorkspace(Workspace $workspace) {
179 179
         return $this->_removeWithPost("{$workspace}/removeUser", [
180 180
             'user' => $this->getGid()
181 181
         ], 'workspaces', [$workspace]);
Please login to merge, or discard this patch.
src/Task/Attachment.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         'parent' => Task::class
34 34
     ];
35 35
 
36
-    final public function __toString (): string {
36
+    final public function __toString(): string {
37 37
         return "attachments/{$this->getGid()}";
38 38
     }
39 39
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      * @param string $file
46 46
      * @return $this
47 47
      */
48
-    public function upload (string $file) {
48
+    public function upload(string $file) {
49 49
         // api returns compact version. reload.
50 50
         $remote = $this->api->upload($file, "{$this->getParent()}/attachments");
51 51
         $this->data['gid'] = $remote['gid'];
Please login to merge, or discard this patch.
src/Project.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
      */
79 79
     private $defaultSection;
80 80
 
81
-    final public function __toString (): string {
81
+    final public function __toString(): string {
82 82
         return "projects/{$this->getGid()}";
83 83
     }
84 84
 
85
-    final protected function _getDir (): string {
85
+    final protected function _getDir(): string {
86 86
         return 'projects';
87 87
     }
88 88
 
89
-    protected function _setData (array $data): void {
89
+    protected function _setData(array $data): void {
90 90
         // this is always empty. fields are in the settings, values are in tasks.
91 91
         unset($data['custom_fields']);
92 92
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @param User $user
102 102
      * @return $this
103 103
      */
104
-    public function addMember (User $user) {
104
+    public function addMember(User $user) {
105 105
         return $this->addMembers([$user]);
106 106
     }
107 107
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      * @param User[] $users
111 111
      * @return $this
112 112
      */
113
-    public function addMembers (array $users) {
113
+    public function addMembers(array $users) {
114 114
         return $this->_addWithPost("{$this}/addMembers", [
115 115
             'members' => array_column($users, 'gid')
116 116
         ], 'members', $users);
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      * @param string $target
122 122
      * @return ProjectWebhook
123 123
      */
124
-    public function addWebhook (string $target) {
124
+    public function addWebhook(string $target) {
125 125
         /** @var ProjectWebhook $webhook */
126 126
         $webhook = $this->api->factory($this, ProjectWebhook::class);
127 127
         return $webhook->create($this, $target);
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      * @param array $schedule
147 147
      * @return Job
148 148
      */
149
-    public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) {
149
+    public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) {
150 150
         $data = ['name' => $name];
151 151
         if ($team) {
152 152
             $data['team'] = $team->getGid();
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      * @depends after-create
167 167
      * @return Section
168 168
      */
169
-    public function getDefaultSection () {
169
+    public function getDefaultSection() {
170 170
         return $this->defaultSection ?? $this->defaultSection = $this->getSections(1)[0];
171 171
     }
172 172
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
      * @param null|string $token
180 180
      * @return Event[]
181 181
      */
182
-    public function getEvents (&$token) {
182
+    public function getEvents(&$token) {
183 183
         return $this->api->sync($this->getGid(), $token);
184 184
     }
185 185
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      * @param int $limit
192 192
      * @return Traversable|Section[]
193 193
      */
194
-    public function getIterator (int $limit = PHP_INT_MAX) {
194
+    public function getIterator(int $limit = PHP_INT_MAX) {
195 195
         return $this->api->loadEach($this, Section::class, "{$this}/sections", ['limit' => $limit]);
196 196
     }
197 197
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      * @param int $limit
201 201
      * @return Section[]
202 202
      */
203
-    public function getSections (int $limit = PHP_INT_MAX) {
203
+    public function getSections(int $limit = PHP_INT_MAX) {
204 204
         return iterator_to_array($this->getIterator($limit));
205 205
     }
206 206
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
      * @depends after-create
209 209
      * @return Status[]
210 210
      */
211
-    public function getStatuses () {
211
+    public function getStatuses() {
212 212
         return $this->api->loadAll($this, Status::class, "{$this}/project_statuses");
213 213
     }
214 214
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
      * @depends after-create
217 217
      * @return TaskCounts
218 218
      */
219
-    public function getTaskCounts () {
219
+    public function getTaskCounts() {
220 220
         /** @var array $remote */
221 221
         $remote = $this->api->get("{$this}/task_counts", [], TaskCounts::OPT);
222 222
         return $this->api->factory($this, TaskCounts::class, $remote);
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      * @param array $filter
230 230
      * @return Task[]
231 231
      */
232
-    public function getTasks (array $filter = Task::FILTER_INCOMPLETE) {
232
+    public function getTasks(array $filter = Task::FILTER_INCOMPLETE) {
233 233
         $filter['project'] = $this->getGid();
234 234
         return $this->api->loadAll($this, Task::class, "tasks", $filter);
235 235
     }
@@ -238,25 +238,25 @@  discard block
 block discarded – undo
238 238
      * @depends after-create
239 239
      * @return string
240 240
      */
241
-    public function getUrl (): string {
241
+    public function getUrl(): string {
242 242
         return "https://app.asana.com/0/{$this->getGid()}";
243 243
     }
244 244
 
245 245
     /**
246 246
      * @return ProjectWebhook[]
247 247
      */
248
-    public function getWebhooks () {
248
+    public function getWebhooks() {
249 249
         return $this->api->loadAll($this, ProjectWebhook::class, 'webhooks', [
250 250
             'workspace' => $this->getWorkspace()->getGid(),
251 251
             'resource' => $this->getGid()
252 252
         ]);
253 253
     }
254 254
 
255
-    public function isBoard (): bool {
255
+    public function isBoard(): bool {
256 256
         return $this->getLayout() === self::LAYOUT_BOARD;
257 257
     }
258 258
 
259
-    public function isList (): bool {
259
+    public function isList(): bool {
260 260
         return $this->getLayout() === self::LAYOUT_LIST;
261 261
     }
262 262
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
      * @depends after-create
265 265
      * @return Section
266 266
      */
267
-    public function newSection () {
267
+    public function newSection() {
268 268
         return $this->api->factory($this, Section::class, ['project' => $this]);
269 269
     }
270 270
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
      * @depends after-create
273 273
      * @return Status
274 274
      */
275
-    public function newStatus () {
275
+    public function newStatus() {
276 276
         return $this->api->factory($this, Status::class);
277 277
     }
278 278
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
      * @depends after-create
283 283
      * @return Task
284 284
      */
285
-    public function newTask () {
285
+    public function newTask() {
286 286
         return $this->getDefaultSection()->newTask();
287 287
     }
288 288
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
      * @param User $user
292 292
      * @return $this
293 293
      */
294
-    public function removeMember (User $user) {
294
+    public function removeMember(User $user) {
295 295
         return $this->removeMembers([$user]);
296 296
     }
297 297
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
      * @param User[] $users
301 301
      * @return $this
302 302
      */
303
-    public function removeMembers (array $users) {
303
+    public function removeMembers(array $users) {
304 304
         return $this->_removeWithPost("{$this}/removeMembers", [
305 305
             'members' => array_column($users, 'gid')
306 306
         ], 'members', $users);
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
      * @param callable $filter `fn( Section $section ): bool`
311 311
      * @return Section[]
312 312
      */
313
-    public function selectSections (callable $filter) {
313
+    public function selectSections(callable $filter) {
314 314
         return $this->_select($this->getSections(), $filter);
315 315
     }
316 316
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
      * @param callable $filter `fn( Status $status ): bool`
319 319
      * @return Status[]
320 320
      */
321
-    public function selectStatuses (callable $filter) {
321
+    public function selectStatuses(callable $filter) {
322 322
         return $this->_select($this->getStatuses(), $filter);
323 323
     }
324 324
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
      * @param array $apiFilter Pre-filter given to the API to reduce network load.
328 328
      * @return Task[]
329 329
      */
330
-    public function selectTasks (callable $filter, array $apiFilter = Task::FILTER_INCOMPLETE) {
330
+    public function selectTasks(callable $filter, array $apiFilter = Task::FILTER_INCOMPLETE) {
331 331
         return $this->_select($this->getTasks($apiFilter), $filter);
332 332
     }
333 333
 
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
      * @param null|Team $team
337 337
      * @return $this
338 338
      */
339
-    public function setTeam (?Team $team) {
339
+    public function setTeam(?Team $team) {
340 340
         if ($team and !$this->hasWorkspace()) {
341 341
             $this->setWorkspace($team->getOrganization());
342 342
         }
Please login to merge, or discard this patch.
src/Api.php 2 patches
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      * @param string $token
49 49
      * @param Pool|null $pool
50 50
      */
51
-    public function __construct (string $token, Pool $pool = null) {
51
+    public function __construct(string $token, Pool $pool = null) {
52 52
         $this->token = $token;
53 53
         $this->pool = $pool ?? new Pool();
54 54
     }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      * @return null|array
63 63
      * @internal
64 64
      */
65
-    protected function _exec (string $method, string $path, array $curlOpts = []) {
65
+    protected function _exec(string $method, string $path, array $curlOpts = []) {
66 66
         $log = $this->getLog();
67 67
         $log->log(LOG_DEBUG, "{$method} {$path}", $curlOpts);
68 68
         /** @var resource $ch */
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         switch ($curlInfo['http_code']) {
94 94
             case 200:
95 95
             case 201:
96
-                return json_decode($body, true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR);
96
+                return json_decode($body, true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR);
97 97
             case 404:
98 98
                 return null;
99 99
             case 429:
@@ -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
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      * @param array $data
127 127
      * @return mixed|Data|AbstractEntity
128 128
      */
129
-    public function factory ($caller, string $class, array $data = []) {
129
+    public function factory($caller, string $class, array $data = []) {
130 130
         return new $class($caller, $data);
131 131
     }
132 132
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      * @param array $opt
139 139
      * @return null|array
140 140
      */
141
-    public function get (string $path, array $query = [], array $opt = []) {
141
+    public function get(string $path, array $query = [], array $opt = []) {
142 142
         foreach ($opt as $name => $value) {
143 143
             $query["opt_{$name}"] = $value;
144 144
         }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      * @param string $gid
153 153
      * @return null|Attachment
154 154
      */
155
-    public function getAttachment (string $gid) {
155
+    public function getAttachment(string $gid) {
156 156
         return $this->load($this, Attachment::class, "attachments/{$gid}");
157 157
     }
158 158
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      * @param string $gid
163 163
      * @return null|CustomField
164 164
      */
165
-    public function getCustomField (string $gid) {
165
+    public function getCustomField(string $gid) {
166 166
         return $this->load($this, CustomField::class, "custom_fields/{$gid}");
167 167
     }
168 168
 
@@ -172,14 +172,14 @@  discard block
 block discarded – undo
172 172
      *
173 173
      * @return Workspace
174 174
      */
175
-    public function getDefaultWorkspace () {
175
+    public function getDefaultWorkspace() {
176 176
         return $this->getMe()->getDefaultWorkspace();
177 177
     }
178 178
 
179 179
     /**
180 180
      * @return LoggerInterface
181 181
      */
182
-    public function getLog () {
182
+    public function getLog() {
183 183
         return $this->log ?? $this->log = new NullLogger();
184 184
     }
185 185
 
@@ -188,14 +188,14 @@  discard block
 block discarded – undo
188 188
      *
189 189
      * @return User
190 190
      */
191
-    public function getMe () {
191
+    public function getMe() {
192 192
         return $this->me ?? $this->me = $this->getUser('me');
193 193
     }
194 194
 
195 195
     /**
196 196
      * @return Pool
197 197
      */
198
-    final public function getPool () {
198
+    final public function getPool() {
199 199
         return $this->pool;
200 200
     }
201 201
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      * @param string $gid
206 206
      * @return null|Portfolio
207 207
      */
208
-    public function getPortfolio (string $gid) {
208
+    public function getPortfolio(string $gid) {
209 209
         return $this->load($this, Portfolio::class, "portfolios/{$gid}");
210 210
     }
211 211
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      * @param string $gid
216 216
      * @return null|Project
217 217
      */
218
-    public function getProject (string $gid) {
218
+    public function getProject(string $gid) {
219 219
         return $this->load($this, Project::class, "projects/{$gid}");
220 220
     }
221 221
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
      * @param string $gid
226 226
      * @return null|Section
227 227
      */
228
-    public function getSection (string $gid) {
228
+    public function getSection(string $gid) {
229 229
         return $this->load($this, Section::class, "sections/{$gid}");
230 230
     }
231 231
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      * @param string $gid
236 236
      * @return null|Story
237 237
      */
238
-    public function getStory (string $gid) {
238
+    public function getStory(string $gid) {
239 239
         return $this->load($this, Story::class, "stories/{$gid}");
240 240
     }
241 241
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
      * @param string $gid
246 246
      * @return null|Tag
247 247
      */
248
-    public function getTag (string $gid) {
248
+    public function getTag(string $gid) {
249 249
         return $this->load($this, Tag::class, "tags/{$gid}");
250 250
     }
251 251
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
      * @param string $gid
256 256
      * @return null|Task
257 257
      */
258
-    public function getTask (string $gid) {
258
+    public function getTask(string $gid) {
259 259
         return $this->load($this, Task::class, "tasks/{$gid}");
260 260
     }
261 261
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      * @param string $gid
266 266
      * @return null|TaskList
267 267
      */
268
-    public function getTaskList (string $gid) {
268
+    public function getTaskList(string $gid) {
269 269
         return $this->load($this, TaskList::class, "user_task_lists/{$gid}");
270 270
     }
271 271
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
      * @param string $gid
276 276
      * @return null|Team
277 277
      */
278
-    public function getTeam (string $gid) {
278
+    public function getTeam(string $gid) {
279 279
         return $this->load($this, Team::class, "teams/{$gid}");
280 280
     }
281 281
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      * @param string $gid
286 286
      * @return null|User
287 287
      */
288
-    public function getUser (string $gid) {
288
+    public function getUser(string $gid) {
289 289
         return $this->load($this, User::class, "users/{$gid}");
290 290
     }
291 291
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
      * @param string $gid
294 294
      * @return ProjectWebhook|TaskWebhook
295 295
      */
296
-    public function getWebhook (string $gid) {
296
+    public function getWebhook(string $gid) {
297 297
         return $this->pool->get($gid, $this, function() use ($gid) {
298 298
             static $classes = [
299 299
                 Project::TYPE => ProjectWebhook::class,
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
      * @param array $data
315 315
      * @return Event
316 316
      */
317
-    public function getWebhookEvent (array $data) {
317
+    public function getWebhookEvent(array $data) {
318 318
         return $this->factory($this, Event::class, $data);
319 319
     }
320 320
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
      * @param string $gid
325 325
      * @return null|Workspace
326 326
      */
327
-    public function getWorkspace (string $gid) {
327
+    public function getWorkspace(string $gid) {
328 328
         return $this->load($this, Workspace::class, "workspaces/{$gid}");
329 329
     }
330 330
 
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
      * @param string $name
335 335
      * @return null|Workspace
336 336
      */
337
-    public function getWorkspaceByName (string $name) {
337
+    public function getWorkspaceByName(string $name) {
338 338
         foreach ($this->getWorkspaces() as $workspace) {
339 339
             if ($workspace->getName() === $name) {
340 340
                 return $workspace;
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
      *
349 349
      * @return Workspace[]
350 350
      */
351
-    public function getWorkspaces () {
351
+    public function getWorkspaces() {
352 352
         return $this->getMe()->getWorkspaces();
353 353
     }
354 354
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
      * @param array $query
362 362
      * @return null|mixed|AbstractEntity
363 363
      */
364
-    public function load ($caller, string $class, string $path, array $query = []) {
364
+    public function load($caller, string $class, string $path, array $query = []) {
365 365
         $key = rtrim($path . '?' . http_build_query($query), '?');
366 366
         return $this->pool->get($key, $caller, function($caller) use ($class, $path, $query) {
367 367
             if ($data = $this->get($path, $query, ['expand' => 'this'])) {
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
      * @param array $query
381 381
      * @return array|AbstractEntity[]
382 382
      */
383
-    public function loadAll ($caller, string $class, string $path, array $query = []) {
383
+    public function loadAll($caller, string $class, string $path, array $query = []) {
384 384
         return iterator_to_array($this->loadEach(...func_get_args()));
385 385
     }
386 386
 
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
      * @param array $query `limit` can exceed `100` here.
396 396
      * @return Generator|AbstractEntity[]
397 397
      */
398
-    public function loadEach ($caller, string $class, string $path, array $query = []) {
398
+    public function loadEach($caller, string $class, string $path, array $query = []) {
399 399
         $query['opt_expand'] = 'this';
400 400
         $remain = $query['limit'] ?? PHP_INT_MAX;
401 401
         do {
@@ -419,13 +419,13 @@  discard block
 block discarded – undo
419 419
      * @param array $opt
420 420
      * @return null|array
421 421
      */
422
-    public function post (string $path, array $data = [], array $opt = []) {
422
+    public function post(string $path, array $data = [], array $opt = []) {
423 423
         $response = $this->_exec('POST', $path, [
424 424
             CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
425 425
             CURLOPT_POSTFIELDS => json_encode([
426 426
                 'options' => $opt,
427 427
                 'data' => $data
428
-            ], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR)
428
+            ], JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR)
429 429
         ]);
430 430
         return $response['data'] ?? null;
431 431
     }
@@ -438,13 +438,13 @@  discard block
 block discarded – undo
438 438
      * @param array $opt
439 439
      * @return null|array
440 440
      */
441
-    public function put (string $path, array $data = [], array $opt = []) {
441
+    public function put(string $path, array $data = [], array $opt = []) {
442 442
         $response = $this->_exec('PUT', $path, [
443 443
             CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
444 444
             CURLOPT_POSTFIELDS => json_encode([
445 445
                 'options' => $opt,
446 446
                 'data' => $data
447
-            ], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR)
447
+            ], JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR)
448 448
         ]);
449 449
         return $response['data'] ?? null;
450 450
     }
@@ -452,14 +452,14 @@  discard block
 block discarded – undo
452 452
     /**
453 453
      * @param LoggerInterface $log
454 454
      */
455
-    public function setLog (LoggerInterface $log) {
455
+    public function setLog(LoggerInterface $log) {
456 456
         $this->log = $log;
457 457
     }
458 458
 
459 459
     /**
460 460
      * @param Pool $pool
461 461
      */
462
-    public function setPool (Pool $pool) {
462
+    public function setPool(Pool $pool) {
463 463
         $this->pool = $pool;
464 464
     }
465 465
 
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
      * @param null|string $token Updated to the new token.
477 477
      * @return Event[]
478 478
      */
479
-    public function sync (string $gid, ?string &$token) {
479
+    public function sync(string $gid, ?string &$token) {
480 480
         try {
481 481
             /** @var array $remote Asana throws 400 for missing entities here. */
482 482
             $remote = $this->_exec('GET', 'events?' . http_build_query([
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
         }
488 488
         catch (AsanaError $error) {
489 489
             if ($error->getCode() === 412) {
490
-                $remote = json_decode($error->getMessage(), true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR);
490
+                $remote = json_decode($error->getMessage(), true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR);
491 491
                 if (!isset($token)) {
492 492
                     // API docs say: "The response will be the same as for an expired sync token."
493 493
                     // The caller knowingly gave a null token, so we don't need to rethrow.
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
      * @param string $to
517 517
      * @return array
518 518
      */
519
-    public function upload (string $file, string $to) {
519
+    public function upload(string $file, string $to) {
520 520
         return $this->_exec('POST', $to, [
521 521
             CURLOPT_POSTFIELDS => ['file' => new CURLFile(realpath($file))] // multipart/form-data
522 522
         ])['data'];
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -484,8 +484,7 @@
 block discarded – undo
484 484
                     'sync' => $token,
485 485
                     'opt_expand' => 'this'
486 486
                 ]));
487
-        }
488
-        catch (AsanaError $error) {
487
+        } catch (AsanaError $error) {
489 488
             if ($error->getCode() === 412) {
490 489
                 $remote = json_decode($error->getMessage(), true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR);
491 490
                 if (!isset($token)) {
Please login to merge, or discard this patch.