@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function __call(string $name, array $arguments) |
187 | 187 | { |
188 | - if (! isset($this->parentModel) && array_key_exists($name, $this->rootModels)) { |
|
188 | + if (!isset($this->parentModel) && array_key_exists($name, $this->rootModels)) { |
|
189 | 189 | return $this->newInstanceForModel($this->rootModels[$name]); |
190 | 190 | } |
191 | 191 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * @throws NoClientException |
207 | 207 | * @throws TokenException |
208 | 208 | */ |
209 | - public function __get(string $name): Collection|Model|null |
|
209 | + public function __get(string $name): Collection | Model | null |
|
210 | 210 | { |
211 | 211 | return match (true) { |
212 | 212 | $name === 'agent' => $this->newInstanceForModel(Agent::class) |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $name === 'user' => $this->newInstanceForModel(User::class) |
219 | 219 | ->get(extra: 'me') |
220 | 220 | ->first(), |
221 | - ! $this->parentModel && array_key_exists($name, $this->rootModels) => $this->{$name}() |
|
221 | + !$this->parentModel && array_key_exists($name, $this->rootModels) => $this->{$name}() |
|
222 | 222 | ->get(), |
223 | 223 | default => null, |
224 | 224 | }; |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @throws NoClientException |
258 | 258 | * @throws TokenException |
259 | 259 | */ |
260 | - public function get(array|string $properties = ['*'], ?string $extra = null): Collection|Model |
|
260 | + public function get(array | string $properties = ['*'], ?string $extra = null): Collection | Model |
|
261 | 261 | { |
262 | 262 | $properties = Arr::wrap($properties); |
263 | 263 | $count = null; |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | ->toArray() |
295 | 295 | ) |
296 | 296 | ->setClient($this->getClient()->setDebug(false))) |
297 | - ->setPagination(count: $count, page: $page, pageSize: $pageSize); |
|
297 | + ->setPagination(count : $count, page : $page, pageSize : $pageSize); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | /** |
@@ -304,11 +304,11 @@ discard block |
||
304 | 304 | */ |
305 | 305 | public function getModel(): Model |
306 | 306 | { |
307 | - if (! isset($this->class)) { |
|
307 | + if (!isset($this->class)) { |
|
308 | 308 | throw new InvalidRelationshipException(); |
309 | 309 | } |
310 | 310 | |
311 | - if (! isset($this->model)) { |
|
311 | + if (!isset($this->model)) { |
|
312 | 312 | $this->model = (new $this->class([], $this->parentModel))->setClient($this->client); |
313 | 313 | } |
314 | 314 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $id = Arr::pull($w, $this->getModel()->getKeyName()); |
327 | 327 | |
328 | 328 | return $this->getModel() |
329 | - ->getPath($extra.(is_null($id) ? null : '/'.$id), $w); |
|
329 | + ->getPath($extra . (is_null($id) ? null : '/' . $id), $w); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | /** |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | * @throws NoClientException |
338 | 338 | * @throws TokenException |
339 | 339 | */ |
340 | - public function find(int|string $id, array|string $properties = ['*']): Model |
|
340 | + public function find(int | string $id, array | string $properties = ['*']): Model |
|
341 | 341 | { |
342 | 342 | return $this->whereId($id) |
343 | 343 | ->get($properties) |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * |
360 | 360 | * @throws InvalidRelationshipException |
361 | 361 | */ |
362 | - public function limit(int|string $count): self |
|
362 | + public function limit(int | string $count): self |
|
363 | 363 | { |
364 | 364 | return $this->where('count', (int) $count); |
365 | 365 | } |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * |
445 | 445 | * @throws InvalidRelationshipException |
446 | 446 | */ |
447 | - public function page(int|string $number, int|string|null $size = null): self |
|
447 | + public function page(int | string $number, int | string | null $size = null): self |
|
448 | 448 | { |
449 | 449 | return $this->where('page_no', (int) $number) |
450 | 450 | ->when($size, fn (self $b): self => $b->paginate($size)); |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | * |
456 | 456 | * @throws InvalidRelationshipException |
457 | 457 | */ |
458 | - public function pageinate(int|string|null $size = null): self |
|
458 | + public function pageinate(int | string | null $size = null): self |
|
459 | 459 | { |
460 | 460 | return $this->paginate($size); |
461 | 461 | } |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | * |
466 | 466 | * @throws InvalidRelationshipException |
467 | 467 | */ |
468 | - public function paginate(int|string|null $size = null): self |
|
468 | + public function paginate(int | string | null $size = null): self |
|
469 | 469 | { |
470 | 470 | return $this->unless($size, fn (self $b): self => $b->where('pageinate', false)) |
471 | 471 | ->when($size, fn (self $b): self => $b->where('pageinate', true)->where('page_size', (int) $size)); |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | */ |
512 | 512 | public function setClass(string $class): self |
513 | 513 | { |
514 | - if (! class_exists($class)) { |
|
514 | + if (!class_exists($class)) { |
|
515 | 515 | throw new ModelNotFoundException(sprintf('The model [%s] not found.', $class)); |
516 | 516 | } |
517 | 517 | |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | * |
536 | 536 | * @throws InvalidRelationshipException |
537 | 537 | */ |
538 | - public function take(int|string $count): self |
|
538 | + public function take(int | string $count): self |
|
539 | 539 | { |
540 | 540 | return $this->limit($count); |
541 | 541 | } |
@@ -545,12 +545,12 @@ discard block |
||
545 | 545 | * |
546 | 546 | * @throws InvalidRelationshipException |
547 | 547 | */ |
548 | - public function where(iterable|string $property, $value = true): self |
|
548 | + public function where(iterable | string $property, $value = true): self |
|
549 | 549 | { |
550 | 550 | is_iterable($property) |
551 | 551 | // Given multiple properties to set, so recursively call self |
552 | 552 | ? Collection::wrap($property)->each( |
553 | - fn ($v, string $p): self => is_numeric($p) |
|
553 | + fn ($v, string $p) : self => is_numeric($p) |
|
554 | 554 | // No value given, so use default value |
555 | 555 | ? $this->where($v, $value) |
556 | 556 | // Pass property & value |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | * |
570 | 570 | * @throws InvalidRelationshipException |
571 | 571 | */ |
572 | - public function whereId(int|string|null $id): self |
|
572 | + public function whereId(int | string | null $id): self |
|
573 | 573 | { |
574 | 574 | return $this->where($this->getModel()->getKeyName(), $id); |
575 | 575 | } |