Test Setup Failed
Push — develop ( 96f007...973626 )
by Jimmy
25:28 queued 10:27
created
src/Support/Builder.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      */
190 190
     public function __call(string $name, array $arguments)
191 191
     {
192
-        if (! isset($this->parentModel) && array_key_exists($name, $this->rootModels)) {
192
+        if (!isset($this->parentModel) && array_key_exists($name, $this->rootModels)) {
193 193
             return $this->newInstanceForModel($this->rootModels[$name]);
194 194
         }
195 195
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      * @throws NoClientException
211 211
      * @throws TokenException
212 212
      */
213
-    public function __get(string $name): Collection|Model|null
213
+    public function __get(string $name): Collection | Model | null
214 214
     {
215 215
         return match (true) {
216 216
             $name === 'agent' => $this->newInstanceForModel(Agent::class)
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
             $name === 'user' => $this->newInstanceForModel(User::class)
223 223
                 ->get(extra: 'me')
224 224
                 ->first(),
225
-            ! $this->parentModel && array_key_exists($name, $this->rootModels) => $this->{$name}()
225
+            !$this->parentModel && array_key_exists($name, $this->rootModels) => $this->{$name}()
226 226
                 ->get(),
227 227
             default => null,
228 228
         };
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
      * @throws NoClientException
260 260
      * @throws TokenException
261 261
      */
262
-    public function delete(int|string $id): bool
262
+    public function delete(int | string $id): bool
263 263
     {
264 264
         //  TODO: Consider allowing $id to be null & deleting all
265 265
         return $this->make([$this->getModel()->getKeyName() => $id])
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
      * @throws NoClientException
275 275
      * @throws TokenException
276 276
      */
277
-    public function get(array|string $properties = ['*'], ?string $extra = null): Collection|Model
277
+    public function get(array | string $properties = ['*'], ?string $extra = null): Collection | Model
278 278
     {
279 279
         $properties = Arr::wrap($properties);
280 280
         $count = null;
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
                             ->toArray()
312 312
                 )
313 313
                 ->setClient($this->getClient()->setDebug(false)))
314
-            ->setPagination(count: $count, page: $page, pageSize: $pageSize);
314
+            ->setPagination(count : $count, page : $page, pageSize : $pageSize);
315 315
     }
316 316
 
317 317
     /**
@@ -321,11 +321,11 @@  discard block
 block discarded – undo
321 321
      */
322 322
     public function getModel(): Model
323 323
     {
324
-        if (! isset($this->class)) {
324
+        if (!isset($this->class)) {
325 325
             throw new InvalidRelationshipException();
326 326
         }
327 327
 
328
-        if (! isset($this->model)) {
328
+        if (!isset($this->model)) {
329 329
             $this->model = (new $this->class([], $this->parentModel))->setClient($this->client);
330 330
         }
331 331
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
         $id = Arr::pull($w, $this->getModel()->getKeyName());
344 344
 
345 345
         return $this->getModel()
346
-            ->getPath($extra.(is_null($id) ? null : '/'.$id), $w);
346
+            ->getPath($extra . (is_null($id) ? null : '/' . $id), $w);
347 347
     }
348 348
 
349 349
     /**
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
      * @throws NoClientException
355 355
      * @throws TokenException
356 356
      */
357
-    public function find(int|string $id, array|string $properties = ['*']): Model
357
+    public function find(int | string $id, array | string $properties = ['*']): Model
358 358
     {
359 359
         return $this->whereId($id)
360 360
             ->get($properties)
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
      *
377 377
      * @throws InvalidRelationshipException
378 378
      */
379
-    public function limit(int|string $count): self
379
+    public function limit(int | string $count): self
380 380
     {
381 381
         return $this->where('count', (int) $count);
382 382
     }
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
      *
462 462
      * @throws InvalidRelationshipException
463 463
      */
464
-    public function page(int|string $number, int|string|null $size = null): self
464
+    public function page(int | string $number, int | string | null $size = null): self
465 465
     {
466 466
         return $this->where('page_no', (int) $number)
467 467
             ->when($size, fn (self $b): self => $b->paginate($size));
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
      *
473 473
      * @throws InvalidRelationshipException
474 474
      */
475
-    public function pageinate(int|string|null $size = null): self
475
+    public function pageinate(int | string | null $size = null): self
476 476
     {
477 477
         return $this->paginate($size);
478 478
     }
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
      *
483 483
      * @throws InvalidRelationshipException
484 484
      */
485
-    public function paginate(int|string|null $size = null): self
485
+    public function paginate(int | string | null $size = null): self
486 486
     {
487 487
         return $this->unless($size, fn (self $b): self => $b->where('pageinate', false))
488 488
             ->when($size, fn (self $b): self => $b->where('pageinate', true)->where('page_size', (int) $size));
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
      */
529 529
     public function setClass(string $class): self
530 530
     {
531
-        if (! class_exists($class)) {
531
+        if (!class_exists($class)) {
532 532
             throw new ModelNotFoundException(sprintf('The model [%s] not found.', $class));
533 533
         }
534 534
 
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
      *
553 553
      * @throws InvalidRelationshipException
554 554
      */
555
-    public function take(int|string $count): self
555
+    public function take(int | string $count): self
556 556
     {
557 557
         return $this->limit($count);
558 558
     }
@@ -562,12 +562,12 @@  discard block
 block discarded – undo
562 562
      *
563 563
      * @throws InvalidRelationshipException
564 564
      */
565
-    public function where(iterable|string $property, $value = true): self
565
+    public function where(iterable | string $property, $value = true): self
566 566
     {
567 567
         is_iterable($property)
568 568
             // Given multiple properties to set, so recursively call self
569 569
             ? Collection::wrap($property)->each(
570
-                fn ($v, string $p): self => is_numeric($p)
570
+                fn ($v, string $p) : self => is_numeric($p)
571 571
                     // No value given, so use default value
572 572
                     ? $this->where($v, $value)
573 573
                     // Pass property & value
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
      *
587 587
      * @throws InvalidRelationshipException
588 588
      */
589
-    public function whereId(int|string|null $id): self
589
+    public function whereId(int | string | null $id): self
590 590
     {
591 591
         return $this->where($this->getModel()->getKeyName(), $id);
592 592
     }
Please login to merge, or discard this patch.
src/Support/Model.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         $foreignKey = $foreignKey ?? $this->assumeForeignKey($related);
257 257
 
258 258
         $builder = (new Builder())->setClass($related)
259
-                                  ->setClient($this->getClient());
259
+                                    ->setClient($this->getClient());
260 260
 
261 261
         return new BelongsTo($builder, $this, $foreignKey);
262 262
     }
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
         $foreignKey = $foreignKey ?? $this->assumeForeignKey($related);
277 277
 
278 278
         $builder = (new Builder())->setClass($related)
279
-                                  ->setClient($this->getClient())
280
-                                  ->setParent($this);
279
+                                    ->setClient($this->getClient())
280
+                                    ->setParent($this);
281 281
 
282 282
         return new ChildOf($builder, $this, $foreignKey);
283 283
     }
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 
310 310
         try {
311 311
             $this->getClient()
312
-                 ->delete($this->getPath($this->getKey()));
312
+                    ->delete($this->getPath($this->getKey()));
313 313
 
314 314
             return true;
315 315
         } catch (GuzzleException $e) {
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
     public function givenOne($related, $attributes, $reset = false): Model
510 510
     {
511 511
         return (new $related([], $this->parentModel))->setClient($this->getClient())
512
-                                                     ->newFromBuilder($reset ? reset($attributes) : $attributes);
512
+                                                        ->newFromBuilder($reset ? reset($attributes) : $attributes);
513 513
     }
514 514
 
515 515
     /**
@@ -524,8 +524,8 @@  discard block
 block discarded – undo
524 524
     public function hasMany($related): HasMany
525 525
     {
526 526
         $builder = (new Builder())->setClass($related)
527
-                                  ->setClient($this->getClient())
528
-                                  ->setParent($this);
527
+                                    ->setClient($this->getClient())
528
+                                    ->setParent($this);
529 529
 
530 530
         return new HasMany($builder, $this);
531 531
     }
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
             }
685 685
 
686 686
             $response = $this->getClient()
687
-                             ->post($this->getPath(), [$this->toArray()]);
687
+                                ->post($this->getPath(), [$this->toArray()]);
688 688
 
689 689
             $this->exists = true;
690 690
 
Please login to merge, or discard this patch.