Passed
Push — master ( 434123...44af68 )
by y
01:43
created
src/Task/Attachment.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      *
40 40
      * @return string
41 41
      */
42
-    final public function __toString (): string {
42
+    final public function __toString(): string {
43 43
         return "attachments/{$this->getGid()}";
44 44
     }
45 45
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      * @param string $file
52 52
      * @return $this
53 53
      */
54
-    public function upload (string $file) {
54
+    public function upload(string $file) {
55 55
         // api returns compact version. reload.
56 56
         $remote = $this->api->call('POST', "{$this->getParent()}/attachments", [
57 57
             CURLOPT_POSTFIELDS => ['file' => new CURLFile(realpath($file))] // multipart/form-data
Please login to merge, or discard this patch.
src/Base/AbstractEntity/SyncTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 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([
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         }
36 36
         catch (AsanaError $error) {
37 37
             if ($error->getCode() === 412) {
38
-                $remote = json_decode($error->getMessage(), true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR);
38
+                $remote = json_decode($error->getMessage(), true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR);
39 39
                 if (!isset($token)) {
40 40
                     // API docs say: "The response will be the same as for an expired sync token."
41 41
                     // The caller knowingly gave a null token, so we don't need to rethrow.
Please login to merge, or discard this patch.
src/Api.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      * @param string $token
43 43
      * @param null|Pool $pool
44 44
      */
45
-    public function __construct (string $token, Pool $pool = null) {
45
+    public function __construct(string $token, Pool $pool = null) {
46 46
         $this->token = $token;
47 47
         $this->pool = $pool ?? new Pool();
48 48
     }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @return null|array
57 57
      * @internal
58 58
      */
59
-    public function call (string $method, string $path, array $curlOpts = []) {
59
+    public function call(string $method, string $path, array $curlOpts = []) {
60 60
         $log = $this->getLog();
61 61
         $log->log(LOG_DEBUG, "{$method} {$path}", $curlOpts);
62 62
         /** @var resource $ch */
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         switch ($curlInfo['http_code']) {
88 88
             case 200:
89 89
             case 201:
90
-                return json_decode($body, true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR);
90
+                return json_decode($body, true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR);
91 91
             case 404:
92 92
                 return null;
93 93
             case 429:
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      *
107 107
      * @param string $path
108 108
      */
109
-    public function delete (string $path): void {
109
+    public function delete(string $path): void {
110 110
         $this->call('DELETE', $path);
111 111
     }
112 112
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      * @param array $data
121 121
      * @return mixed|Data|AbstractEntity
122 122
      */
123
-    public function factory ($caller, string $class, array $data = []) {
123
+    public function factory($caller, string $class, array $data = []) {
124 124
         return new $class($caller, $data);
125 125
     }
126 126
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      * @param array $opt
133 133
      * @return null|array
134 134
      */
135
-    public function get (string $path, array $query = [], array $opt = []) {
135
+    public function get(string $path, array $query = [], array $opt = []) {
136 136
         foreach ($opt as $name => $value) {
137 137
             $query["opt_{$name}"] = $value;
138 138
         }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      * @param string $gid
147 147
      * @return null|Attachment
148 148
      */
149
-    public function getAttachment (string $gid) {
149
+    public function getAttachment(string $gid) {
150 150
         return $this->load($this, Attachment::class, "attachments/{$gid}");
151 151
     }
152 152
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      * @param string $gid
157 157
      * @return null|CustomField
158 158
      */
159
-    public function getCustomField (string $gid) {
159
+    public function getCustomField(string $gid) {
160 160
         return $this->load($this, CustomField::class, "custom_fields/{$gid}");
161 161
     }
162 162
 
@@ -167,28 +167,28 @@  discard block
 block discarded – undo
167 167
      *
168 168
      * @return Workspace
169 169
      */
170
-    public function getDefaultWorkspace () {
170
+    public function getDefaultWorkspace() {
171 171
         return $this->getMe()->getDefaultWorkspace();
172 172
     }
173 173
 
174 174
     /**
175 175
      * @return LoggerInterface
176 176
      */
177
-    public function getLog () {
177
+    public function getLog() {
178 178
         return $this->log ?? $this->log = new NullLogger();
179 179
     }
180 180
 
181 181
     /**
182 182
      * @return User
183 183
      */
184
-    public function getMe () {
184
+    public function getMe() {
185 185
         return $this->getUser('me');
186 186
     }
187 187
 
188 188
     /**
189 189
      * @return Pool
190 190
      */
191
-    public function getPool () {
191
+    public function getPool() {
192 192
         return $this->pool;
193 193
     }
194 194
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
      * @param string $gid
199 199
      * @return null|Portfolio
200 200
      */
201
-    public function getPortfolio (string $gid) {
201
+    public function getPortfolio(string $gid) {
202 202
         return $this->load($this, Portfolio::class, "portfolios/{$gid}");
203 203
     }
204 204
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
      * @param string $gid
209 209
      * @return null|Project
210 210
      */
211
-    public function getProject (string $gid) {
211
+    public function getProject(string $gid) {
212 212
         return $this->load($this, Project::class, "projects/{$gid}");
213 213
     }
214 214
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
      * @param string $gid
219 219
      * @return null|Section
220 220
      */
221
-    public function getSection (string $gid) {
221
+    public function getSection(string $gid) {
222 222
         return $this->load($this, Section::class, "sections/{$gid}");
223 223
     }
224 224
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
      * @param string $gid
229 229
      * @return null|Story
230 230
      */
231
-    public function getStory (string $gid) {
231
+    public function getStory(string $gid) {
232 232
         return $this->load($this, Story::class, "stories/{$gid}");
233 233
     }
234 234
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
      * @param string $gid
239 239
      * @return null|Tag
240 240
      */
241
-    public function getTag (string $gid) {
241
+    public function getTag(string $gid) {
242 242
         return $this->load($this, Tag::class, "tags/{$gid}");
243 243
     }
244 244
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
      * @param string $gid
249 249
      * @return null|Task
250 250
      */
251
-    public function getTask (string $gid) {
251
+    public function getTask(string $gid) {
252 252
         return $this->load($this, Task::class, "tasks/{$gid}");
253 253
     }
254 254
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      * @param string $gid
259 259
      * @return null|TaskList
260 260
      */
261
-    public function getTaskList (string $gid) {
261
+    public function getTaskList(string $gid) {
262 262
         return $this->load($this, TaskList::class, "user_task_lists/{$gid}");
263 263
     }
264 264
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
      * @param string $gid
269 269
      * @return null|Team
270 270
      */
271
-    public function getTeam (string $gid) {
271
+    public function getTeam(string $gid) {
272 272
         return $this->load($this, Team::class, "teams/{$gid}");
273 273
     }
274 274
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
      * @param string $gid
279 279
      * @return null|User
280 280
      */
281
-    public function getUser (string $gid) {
281
+    public function getUser(string $gid) {
282 282
         return $this->load($this, User::class, "users/{$gid}");
283 283
     }
284 284
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
      * @param string $gid
287 287
      * @return ProjectWebhook|TaskWebhook
288 288
      */
289
-    public function getWebhook (string $gid) {
289
+    public function getWebhook(string $gid) {
290 290
         return $this->pool->get($gid, $this, function() use ($gid) {
291 291
             static $classes = [
292 292
                 Project::TYPE => ProjectWebhook::class,
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
      * @param array $data
308 308
      * @return Event
309 309
      */
310
-    public function getWebhookEvent (array $data) {
310
+    public function getWebhookEvent(array $data) {
311 311
         return $this->factory($this, Event::class, $data);
312 312
     }
313 313
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
      * @param string $gid
318 318
      * @return null|Workspace
319 319
      */
320
-    public function getWorkspace (string $gid) {
320
+    public function getWorkspace(string $gid) {
321 321
         return $this->load($this, Workspace::class, "workspaces/{$gid}");
322 322
     }
323 323
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
      * @param array $query
331 331
      * @return null|mixed|AbstractEntity
332 332
      */
333
-    public function load ($caller, string $class, string $path, array $query = []) {
333
+    public function load($caller, string $class, string $path, array $query = []) {
334 334
         $key = rtrim($path . '?' . http_build_query($query), '?');
335 335
         return $this->pool->get($key, $caller, function($caller) use ($class, $path, $query) {
336 336
             if ($data = $this->get($path, $query, ['expand' => 'this'])) {
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
      * @param array $query
350 350
      * @return array|AbstractEntity[]
351 351
      */
352
-    public function loadAll ($caller, string $class, string $path, array $query = []) {
352
+    public function loadAll($caller, string $class, string $path, array $query = []) {
353 353
         return iterator_to_array($this->loadEach(...func_get_args()));
354 354
     }
355 355
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
      * @param array $query `limit` can exceed `100` here.
365 365
      * @return Generator|AbstractEntity[]
366 366
      */
367
-    public function loadEach ($caller, string $class, string $path, array $query = []) {
367
+    public function loadEach($caller, string $class, string $path, array $query = []) {
368 368
         $query['opt_expand'] = 'this';
369 369
         $remain = $query['limit'] ?? PHP_INT_MAX;
370 370
         do {
@@ -388,13 +388,13 @@  discard block
 block discarded – undo
388 388
      * @param array $opt
389 389
      * @return null|array
390 390
      */
391
-    public function post (string $path, array $data = [], array $opt = []) {
391
+    public function post(string $path, array $data = [], array $opt = []) {
392 392
         $response = $this->call('POST', $path, [
393 393
             CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
394 394
             CURLOPT_POSTFIELDS => json_encode([
395 395
                 'options' => $opt,
396 396
                 'data' => $data
397
-            ], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR)
397
+            ], JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR)
398 398
         ]);
399 399
         return $response['data'] ?? null;
400 400
     }
@@ -407,13 +407,13 @@  discard block
 block discarded – undo
407 407
      * @param array $opt
408 408
      * @return null|array
409 409
      */
410
-    public function put (string $path, array $data = [], array $opt = []) {
410
+    public function put(string $path, array $data = [], array $opt = []) {
411 411
         $response = $this->call('PUT', $path, [
412 412
             CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
413 413
             CURLOPT_POSTFIELDS => json_encode([
414 414
                 'options' => $opt,
415 415
                 'data' => $data
416
-            ], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR)
416
+            ], JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR)
417 417
         ]);
418 418
         return $response['data'] ?? null;
419 419
     }
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
     /**
422 422
      * @param LoggerInterface $log
423 423
      */
424
-    public function setLog (LoggerInterface $log) {
424
+    public function setLog(LoggerInterface $log) {
425 425
         $this->log = $log;
426 426
     }
427 427
 }
428 428
\ No newline at end of file
Please login to merge, or discard this patch.