Passed
Push — master ( 98502e...866c3b )
by y
01:37
created
src/Api/SimpleCache.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     /**
35 35
      * @param PSR16 $psr
36 36
      */
37
-    public function __construct (PSR16 $psr) {
37
+    public function __construct(PSR16 $psr) {
38 38
         $this->psr = $psr;
39 39
         $this->ttl = new DateInterval('PT1H');
40 40
     }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      * @param string $key
44 44
      * @throws InvalidArgumentException
45 45
      */
46
-    protected function _delete (string $key) {
46
+    protected function _delete(string $key) {
47 47
         $this->psr->delete('asana:' . $key);
48 48
     }
49 49
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      * @return null|string|AbstractEntity
53 53
      * @throws InvalidArgumentException
54 54
      */
55
-    protected function _get (string $key) {
55
+    protected function _get(string $key) {
56 56
         return $this->psr->get('asana:' . $key);
57 57
     }
58 58
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @param mixed $value
62 62
      * @throws InvalidArgumentException
63 63
      */
64
-    protected function _set (string $key, $value) {
64
+    protected function _set(string $key, $value) {
65 65
         $this->psr->set('asana:' . $key, $value, $this->ttl);
66 66
     }
67 67
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      * @return bool
71 71
      * @throws InvalidArgumentException
72 72
      */
73
-    public function add (AbstractEntity $entity): bool {
73
+    public function add(AbstractEntity $entity): bool {
74 74
         if (parent::add($entity)) {
75 75
             $this->_set($entity->getGid(), $entity);
76 76
             return true;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      * @param string[] $keys
84 84
      * @throws InvalidArgumentException
85 85
      */
86
-    protected function addKeys (string $gid, array $keys): void {
86
+    protected function addKeys(string $gid, array $keys): void {
87 87
         parent::addKeys($gid, $keys);
88 88
         // stash gid refs
89 89
         foreach ($keys as $key) {
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      * @return null|AbstractEntity
101 101
      * @throws InvalidArgumentException
102 102
      */
103
-    public function get (string $key, $caller, Closure $factory) {
103
+    public function get(string $key, $caller, Closure $factory) {
104 104
         // POOL MISS && CACHE HIT
105 105
         if (!isset($this->gids[$key]) and $entity = $this->_get($key)) {
106 106
             if ($entity instanceof AbstractEntity) {
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     /**
124 124
      * @return DateInterval
125 125
      */
126
-    public function getTtl () {
126
+    public function getTtl() {
127 127
         return $this->ttl;
128 128
     }
129 129
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      * @param AbstractEntity $entity
132 132
      * @throws InvalidArgumentException
133 133
      */
134
-    public function remove (AbstractEntity $entity): void {
134
+    public function remove(AbstractEntity $entity): void {
135 135
         parent::remove($entity);
136 136
         foreach ($entity->getCacheKeys() as $key) {
137 137
             $this->_delete($key);
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      * @param DateInterval $ttl
143 143
      * @return $this
144 144
      */
145
-    public function setTtl (DateInterval $ttl) {
145
+    public function setTtl(DateInterval $ttl) {
146 146
         $this->ttl = $ttl;
147 147
         return $this;
148 148
     }
Please login to merge, or discard this patch.
src/Job.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         'new_task' => Task::class
34 34
     ];
35 35
 
36
-    final public function __toString (): string {
36
+    final public function __toString(): string {
37 37
         return "jobs/{$this->getGid()}";
38 38
     }
39 39
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      *
43 43
      * @return bool
44 44
      */
45
-    public function isActive (): bool {
45
+    public function isActive(): bool {
46 46
         return $this->getStatus() === self::STATUS_ACTIVE;
47 47
     }
48 48
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      *
52 52
      * @return bool
53 53
      */
54
-    public function isDone (): bool {
54
+    public function isDone(): bool {
55 55
         return $this->isSuccessful() or $this->isFailed();
56 56
     }
57 57
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      *
61 61
      * @return bool
62 62
      */
63
-    public function isFailed (): bool {
63
+    public function isFailed(): bool {
64 64
         return $this->getStatus() === self::STATUS_FAIL;
65 65
     }
66 66
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      *
70 70
      * @return bool
71 71
      */
72
-    public function isQueued (): bool {
72
+    public function isQueued(): bool {
73 73
         return $this->getStatus() === self::STATUS_QUEUED;
74 74
     }
75 75
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      *
79 79
      * @return bool
80 80
      */
81
-    public function isSuccessful (): bool {
81
+    public function isSuccessful(): bool {
82 82
         return $this->getStatus() === self::STATUS_SUCCESS;
83 83
     }
84 84
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      * @param callable $spinner `fn( Job $this ): void`
91 91
      * @return $this
92 92
      */
93
-    public function wait (callable $spinner = null) {
93
+    public function wait(callable $spinner = null) {
94 94
         while (!$this->isDone()) {
95 95
             if ($spinner) {
96 96
                 call_user_func($spinner, $this);
Please login to merge, or discard this patch.
src/Workspace/OrganizationExport.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
         'organization' => Workspace::class
34 34
     ];
35 35
 
36
-    final public function __toString (): string {
36
+    final public function __toString(): string {
37 37
         return "organization_exports/{$this->getGid()}";
38 38
     }
39 39
 
40
-    final protected function _getDir (): string {
40
+    final protected function _getDir(): string {
41 41
         return "organization_exports";
42 42
     }
43 43
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      * @param Workspace $organization
46 46
      * @return $this
47 47
      */
48
-    public function create (Workspace $organization) {
48
+    public function create(Workspace $organization) {
49 49
         $this->_set('organization', $organization);
50 50
         return $this->_create();
51 51
     }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      *
56 56
      * @return bool
57 57
      */
58
-    public function isActive (): bool {
58
+    public function isActive(): bool {
59 59
         return $this->getState() === self::STATE_ACTIVE;
60 60
     }
61 61
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      *
65 65
      * @return bool
66 66
      */
67
-    public function isDone (): bool {
67
+    public function isDone(): bool {
68 68
         return $this->isSuccessful() or $this->isFailed();
69 69
     }
70 70
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      *
74 74
      * @return bool
75 75
      */
76
-    public function isFailed (): bool {
76
+    public function isFailed(): bool {
77 77
         return $this->getState() === self::STATE_FAIL;
78 78
     }
79 79
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      *
83 83
      * @return bool
84 84
      */
85
-    public function isQueued (): bool {
85
+    public function isQueued(): bool {
86 86
         return $this->getState() === self::STATE_QUEUED;
87 87
     }
88 88
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      *
92 92
      * @return bool
93 93
      */
94
-    public function isSuccessful (): bool {
94
+    public function isSuccessful(): bool {
95 95
         return $this->getState() === self::STATE_SUCCESS;
96 96
     }
97 97
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      * @param callable $spinner `fn( OrganizationExport $this ): void`
104 104
      * @return $this
105 105
      */
106
-    public function wait (callable $spinner = null) {
106
+    public function wait(callable $spinner = null) {
107 107
         while (!$this->isDone()) {
108 108
             if ($spinner) {
109 109
                 call_user_func($spinner, $this);
Please login to merge, or discard this patch.
src/Base/AbstractEntity/CreateTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@
 block discarded – undo
12 12
      *
13 13
      * @return string
14 14
      */
15
-    abstract protected function _getDir (): string;
15
+    abstract protected function _getDir(): string;
16 16
 
17 17
     /**
18 18
      * `POST` the new entity to Asana.
19 19
      *
20 20
      * @return $this
21 21
      */
22
-    public function create () {
22
+    public function create() {
23 23
         return $this->{'_save'}($this->_getDir());
24 24
     }
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
src/Base/AbstractEntity/DeleteTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
     /**
11 11
      * `DELETE`
12 12
      */
13
-    public function delete (): void {
13
+    public function delete(): void {
14 14
         $this->{'_delete'}();
15 15
     }
16 16
 }
17 17
\ No newline at end of file
Please login to merge, or discard this patch.
src/Base/AbstractEntity/UpdateTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
      *
13 13
      * @return $this
14 14
      */
15
-    public function update () {
15
+    public function update() {
16 16
         return $this->{'_save'}();
17 17
     }
18 18
 }
19 19
\ No newline at end of file
Please login to merge, or discard this patch.
src/Base/Data.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * @param Api|Data $caller
48 48
      * @param array $data
49 49
      */
50
-    public function __construct ($caller, array $data = []) {
50
+    public function __construct($caller, array $data = []) {
51 51
         $this->api = $caller instanceof self ? $caller->api : $caller;
52 52
         $this->_setData($data);
53 53
     }
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
      * @param array $args
64 64
      * @return mixed
65 65
      */
66
-    public function __call (string $method, array $args) {
66
+    public function __call(string $method, array $args) {
67 67
         static $cache = [];
68
-        if (!$call =& $cache[$method]) {
68
+        if (!$call = & $cache[$method]) {
69 69
             preg_match('/^(get|has|is|set)(.+)$/', $method, $call);
70 70
             $call[1] = '_' . $call[1];
71 71
             $call[2] = preg_replace_callback('/[A-Z]/', function(array $match) {
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         return $this->{$call[1]}($call[2], ...$args);
76 76
     }
77 77
 
78
-    public function __debugInfo (): array {
78
+    public function __debugInfo(): array {
79 79
         return $this->data;
80 80
     }
81 81
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      * @param $field
86 86
      * @return null|Data|mixed
87 87
      */
88
-    final public function __get ($field) {
88
+    final public function __get($field) {
89 89
         return $this->_get($field);
90 90
     }
91 91
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      * @param $field
98 98
      * @return bool
99 99
      */
100
-    final public function __isset ($field) {
100
+    final public function __isset($field) {
101 101
         return true;
102 102
     }
103 103
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      * @param string $field
110 110
      * @return mixed
111 111
      */
112
-    protected function _get (string $field) {
112
+    protected function _get(string $field) {
113 113
         return $this->data[$field] ?? null;
114 114
     }
115 115
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      * @param string $field
124 124
      * @return bool
125 125
      */
126
-    protected function _has (string $field): bool {
126
+    protected function _has(string $field): bool {
127 127
         $value = $this->_get($field);
128 128
         if (isset($value)) {
129 129
             if (is_countable($value)) {
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      * @param string $field
147 147
      * @return bool
148 148
      */
149
-    protected function _is (string $field): bool {
149
+    protected function _is(string $field): bool {
150 150
         return !empty($this->_get($field));
151 151
     }
152 152
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      * @param mixed $value
160 160
      * @return $this
161 161
      */
162
-    protected function _set (string $field, $value) {
162
+    protected function _set(string $field, $value) {
163 163
         $this->data[$field] = $value;
164 164
         $this->diff[$field] = true;
165 165
         return $this;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      *
171 171
      * @param array $data
172 172
      */
173
-    protected function _setData (array $data): void {
173
+    protected function _setData(array $data): void {
174 174
         $this->data = $this->diff = [];
175 175
         foreach ($data as $field => $value) {
176 176
             $this->_setMapped($field, $value);
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      * @param string $field
184 184
      * @param mixed $value
185 185
      */
186
-    protected function _setMapped (string $field, $value): void {
186
+    protected function _setMapped(string $field, $value): void {
187 187
         unset($this->diff[$field]);
188 188
 
189 189
         // use value as-is?
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
      * @param array $data
232 232
      * @return mixed|Data|AbstractEntity
233 233
      */
234
-    final protected function factory (string $class, array $data = []) {
234
+    final protected function factory(string $class, array $data = []) {
235 235
         return $this->api->factory($class, $this, $data);
236 236
     }
237 237
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
      *
241 241
      * @return array
242 242
      */
243
-    public function getDiff (): array {
243
+    public function getDiff(): array {
244 244
         $convert = function($each) use (&$convert) {
245 245
             // convert existing entities to gids
246 246
             if ($each instanceof AbstractEntity and $each->hasGid()) {
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      *
266 266
      * @return bool
267 267
      */
268
-    final public function isDiff (): bool {
268
+    final public function isDiff(): bool {
269 269
         return (bool)$this->diff;
270 270
     }
271 271
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
      * @see toArray()
274 274
      * @return array
275 275
      */
276
-    public function jsonSerialize (): array {
276
+    public function jsonSerialize(): array {
277 277
         return $this->toArray();
278 278
     }
279 279
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
      * @param array $query
288 288
      * @return null|mixed|AbstractEntity
289 289
      */
290
-    final protected function load (string $class, string $path, array $query = []) {
290
+    final protected function load(string $class, string $path, array $query = []) {
291 291
         return $this->api->load($class, $this, $path, $query);
292 292
     }
293 293
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
      * @param int $pages
303 303
      * @return array|AbstractEntity[]
304 304
      */
305
-    final protected function loadAll (string $class, string $path, array $query = [], int $pages = 0) {
305
+    final protected function loadAll(string $class, string $path, array $query = [], int $pages = 0) {
306 306
         return $this->api->loadAll($class, $this, $path, $query, $pages);
307 307
     }
308 308
 
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      *
312 312
      * @return string
313 313
      */
314
-    public function serialize (): string {
314
+    public function serialize(): string {
315 315
         return json_encode($this);
316 316
     }
317 317
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
      *
321 321
      * @return array
322 322
      */
323
-    public function toArray (): array {
323
+    public function toArray(): array {
324 324
         return array_map($dehydrate = function($each) use (&$dehydrate) {
325 325
             if ($each instanceof AbstractEntity and $each->hasGid()) {
326 326
                 return $each->getGid();
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
      *
341 341
      * @param $serialized
342 342
      */
343
-    public function unserialize ($serialized): void {
343
+    public function unserialize($serialized): void {
344 344
         $this->api = Api::getDefault();
345 345
         $data = json_decode($serialized, true);
346 346
         $this->_setData($data);
Please login to merge, or discard this patch.
src/Api.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -52,25 +52,25 @@  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
71 71
             ?? static::$logger = new class implements LoggerInterface {
72 72
 
73
-                public function log (string $message, string $path, array $data = null): void {
73
+                public function log(string $message, string $path, array $data = null): void {
74 74
                     // stub
75 75
                 }
76 76
 
@@ -80,28 +80,28 @@  discard block
 block discarded – undo
80 80
     /**
81 81
      * @param Cache $cache
82 82
      */
83
-    public static function setCache (Cache $cache) {
83
+    public static function setCache(Cache $cache) {
84 84
         static::$cache = $cache;
85 85
     }
86 86
 
87 87
     /**
88 88
      * @param Api $default
89 89
      */
90
-    public static function setDefault (Api $default) {
90
+    public static function setDefault(Api $default) {
91 91
         self::$default = $default;
92 92
     }
93 93
 
94 94
     /**
95 95
      * @param LoggerInterface $logger
96 96
      */
97
-    public static function setLogger (LoggerInterface $logger) {
97
+    public static function setLogger(LoggerInterface $logger) {
98 98
         static::$logger = $logger;
99 99
     }
100 100
 
101 101
     /**
102 102
      * @param string $token
103 103
      */
104
-    public function __construct (string $token) {
104
+    public function __construct(string $token) {
105 105
         $this->token = $token;
106 106
         if (!static::$default) {
107 107
             static::$default = $this;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      * @return null|array
118 118
      * @internal
119 119
      */
120
-    protected function _exec (string $method, string $path, array $opts = []) {
120
+    protected function _exec(string $method, string $path, array $opts = []) {
121 121
         static::getLogger()->log($method, $path, $opts);
122 122
         /** @var resource $ch */
123 123
         $ch = curl_init();
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      * @return string
167 167
      * @internal
168 168
      */
169
-    protected function _getPath (string $path, array $query): string {
169
+    protected function _getPath(string $path, array $query): string {
170 170
         return $query ? $path . '?' . http_build_query($query) : $path;
171 171
     }
172 172
 
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
      * @return null|array
176 176
      * @internal
177 177
      */
178
-    protected function _jsonDecode (string $json) {
179
-        return json_decode($json, true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR);
178
+    protected function _jsonDecode(string $json) {
179
+        return json_decode($json, true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR);
180 180
     }
181 181
 
182 182
     /**
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
      * @return string
185 185
      * @internal
186 186
      */
187
-    protected function _jsonEncode (array $data): string {
188
-        return json_encode($data, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR);
187
+    protected function _jsonEncode(array $data): string {
188
+        return json_encode($data, JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR);
189 189
     }
190 190
 
191 191
     /**
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
      *
194 194
      * @param string $path
195 195
      */
196
-    public function delete (string $path): void {
196
+    public function delete(string $path): void {
197 197
         $this->_exec('DELETE', $path);
198 198
     }
199 199
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      * @param array $data
208 208
      * @return mixed|Data|AbstractEntity
209 209
      */
210
-    public function factory (string $class, $caller, array $data = []) {
210
+    public function factory(string $class, $caller, array $data = []) {
211 211
         return new $class($caller, $data);
212 212
     }
213 213
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
      * @param array $options
220 220
      * @return null|array
221 221
      */
222
-    public function get (string $path, array $query = [], array $options = []) {
222
+    public function get(string $path, array $query = [], array $options = []) {
223 223
         foreach ($options as $name => $value) {
224 224
             $query["opt_{$name}"] = $value;
225 225
         }
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      * @param string $gid
234 234
      * @return null|Attachment
235 235
      */
236
-    public function getAttachment (string $gid) {
236
+    public function getAttachment(string $gid) {
237 237
         return $this->load(Attachment::class, $this, "attachments/{$gid}");
238 238
     }
239 239
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
      * @param string $gid
244 244
      * @return null|CustomField
245 245
      */
246
-    public function getCustomField (string $gid) {
246
+    public function getCustomField(string $gid) {
247 247
         return $this->load(CustomField::class, $this, "custom_fields/{$gid}");
248 248
     }
249 249
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
      *
253 253
      * @return User
254 254
      */
255
-    public function getMe () {
255
+    public function getMe() {
256 256
         return $this->getUser('me');
257 257
     }
258 258
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
      * @param string $gid
263 263
      * @return null|Portfolio
264 264
      */
265
-    public function getPortfolio (string $gid) {
265
+    public function getPortfolio(string $gid) {
266 266
         return $this->load(Portfolio::class, $this, "portfolios/{$gid}");
267 267
     }
268 268
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
      * @param string $gid
273 273
      * @return null|Project
274 274
      */
275
-    public function getProject (string $gid) {
275
+    public function getProject(string $gid) {
276 276
         return $this->load(Project::class, $this, "projects/{$gid}");
277 277
     }
278 278
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
      * @param string $gid
283 283
      * @return null|Section
284 284
      */
285
-    public function getSection (string $gid) {
285
+    public function getSection(string $gid) {
286 286
         return $this->load(Section::class, $this, "sections/{$gid}");
287 287
     }
288 288
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
      * @param string $gid
293 293
      * @return null|Story
294 294
      */
295
-    public function getStory (string $gid) {
295
+    public function getStory(string $gid) {
296 296
         return $this->load(Story::class, $this, "stories/{$gid}");
297 297
     }
298 298
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
      * @param string $gid
303 303
      * @return null|Tag
304 304
      */
305
-    public function getTag (string $gid) {
305
+    public function getTag(string $gid) {
306 306
         return $this->load(Tag::class, $this, "tags/{$gid}");
307 307
     }
308 308
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
      * @param string $gid
313 313
      * @return null|Task
314 314
      */
315
-    public function getTask (string $gid) {
315
+    public function getTask(string $gid) {
316 316
         return $this->load(Task::class, $this, "tasks/{$gid}");
317 317
     }
318 318
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      * @param string $gid
323 323
      * @return null|Team
324 324
      */
325
-    public function getTeam (string $gid) {
325
+    public function getTeam(string $gid) {
326 326
         return $this->load(Team::class, $this, "teams/{$gid}");
327 327
     }
328 328
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
      * @param string $gid
333 333
      * @return null|User
334 334
      */
335
-    public function getUser (string $gid) {
335
+    public function getUser(string $gid) {
336 336
         return $this->load(User::class, $this, "users/{$gid}");
337 337
     }
338 338
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
      * @param array $data
345 345
      * @return ProjectEvent|TaskEvent|StoryEvent
346 346
      */
347
-    public function getWebhookEvent (array $data) {
347
+    public function getWebhookEvent(array $data) {
348 348
         static $classes = [
349 349
             Project::TYPE => ProjectEvent::class,
350 350
             Task::TYPE => TaskEvent::class,
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
      * @param string $gid
360 360
      * @return null|Workspace
361 361
      */
362
-    public function getWorkspace (string $gid) {
362
+    public function getWorkspace(string $gid) {
363 363
         return $this->load(Workspace::class, $this, "workspaces/{$gid}");
364 364
     }
365 365
 
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
      * @param string $name
370 370
      * @return null|Workspace
371 371
      */
372
-    public function getWorkspaceByName (string $name) {
372
+    public function getWorkspaceByName(string $name) {
373 373
         foreach ($this->getMe()->getWorkspaces() as $workspace) {
374 374
             if ($workspace->getName() === $name) {
375 375
                 return $workspace;
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
      * @param array $query
390 390
      * @return null|mixed|AbstractEntity
391 391
      */
392
-    public function load (string $class, $caller, string $path, array $query = []) {
392
+    public function load(string $class, $caller, string $path, array $query = []) {
393 393
         $key = $this->_getPath($path, $query);
394 394
         return $this->getCache()->get($key, $caller, function($caller) use ($class, $path, $query) {
395 395
             $data = $this->get($path, $query, ['expand' => 'this']);
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
      * @param int $pages If positive, stops after this many pages have been fetched.
410 410
      * @return array|AbstractEntity[]
411 411
      */
412
-    public function loadAll (string $class, $caller, string $path, array $query = [], int $pages = 0) {
412
+    public function loadAll(string $class, $caller, string $path, array $query = [], int $pages = 0) {
413 413
         $query['opt_expand'] = 'this';
414 414
         $query += ['limit' => 100];
415 415
         $path = $this->_getPath($path, $query);
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
      * @param array $options
436 436
      * @return null|array
437 437
      */
438
-    public function post (string $path, array $data = [], array $options = []) {
438
+    public function post(string $path, array $data = [], array $options = []) {
439 439
         $response = $this->_exec('POST', $path, [
440 440
             CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
441 441
             CURLOPT_POSTFIELDS => $this->_jsonEncode(['options' => $options, 'data' => $data])
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
      * @param array $options
452 452
      * @return null|array
453 453
      */
454
-    public function put (string $path, array $data = [], array $options = []) {
454
+    public function put(string $path, array $data = [], array $options = []) {
455 455
         $response = $this->_exec('PUT', $path, [
456 456
             CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
457 457
             CURLOPT_POSTFIELDS => $this->_jsonEncode(['options' => $options, 'data' => $data])
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
      * @param null|string $token
471 471
      * @return ProjectEvent[]|TaskEvent[]|StoryEvent[]
472 472
      */
473
-    public function sync ($entity, ?string &$token) {
473
+    public function sync($entity, ?string &$token) {
474 474
         try {
475 475
             $response = $this->_exec('GET', $this->_getPath('events', [
476 476
                 'resource' => $entity->getGid(),
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
      * @param string $file
506 506
      * @return null|array
507 507
      */
508
-    public function upload (string $path, string $file) {
508
+    public function upload(string $path, string $file) {
509 509
         $response = $this->_exec('POST', $path, [
510 510
             CURLOPT_POSTFIELDS => ['file' => new CURLFile(realpath($file))] // multipart/form-data
511 511
         ]);
Please login to merge, or discard this patch.
src/CustomField/EnumOption.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -33,23 +33,23 @@  discard block
 block discarded – undo
33 33
      */
34 34
     protected $customField;
35 35
 
36
-    public function __construct (CustomField $customField, array $data = []) {
36
+    public function __construct(CustomField $customField, array $data = []) {
37 37
         parent::__construct($customField, $data);
38 38
         $this->customField = $customField;
39 39
     }
40 40
 
41
-    final public function __toString (): string {
41
+    final public function __toString(): string {
42 42
         return "enum_options/{$this->getGid()}";
43 43
     }
44 44
 
45
-    final protected function _getDir (): string {
45
+    final protected function _getDir(): string {
46 46
         return "{$this->customField}/enum_options";
47 47
     }
48 48
 
49 49
     /**
50 50
      * @return CustomField
51 51
      */
52
-    public function getCustomField () {
52
+    public function getCustomField() {
53 53
         return $this->customField;
54 54
     }
55 55
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @param EnumOption $option
59 59
      * @return $this
60 60
      */
61
-    public function moveAfter (EnumOption $option) {
61
+    public function moveAfter(EnumOption $option) {
62 62
         $this->api->post("{$this->_getDir()}/insert", [
63 63
             'after_enum_option' => $option->getGid(),
64 64
             'enum_option' => $this->getGid()
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * @param EnumOption $option
73 73
      * @return $this
74 74
      */
75
-    public function moveBefore (EnumOption $option) {
75
+    public function moveBefore(EnumOption $option) {
76 76
         $this->api->post("{$this->_getDir()}/insert", [
77 77
             'before_enum_option' => $option->getGid(),
78 78
             'enum_option' => $this->getGid()
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     /**
85 85
      * @return $this
86 86
      */
87
-    public function moveFirst () {
87
+    public function moveFirst() {
88 88
         $first = $this->customField->getEnumOptions()[0];
89 89
         if ($first !== $this) {
90 90
             $this->moveBefore($first);
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     /**
96 96
      * @return $this
97 97
      */
98
-    public function moveLast () {
98
+    public function moveLast() {
99 99
         $options = $this->customField->getEnumOptions();
100 100
         $last = $options[count($options) - 1];
101 101
         if ($last !== $this) {
Please login to merge, or discard this patch.