@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | public function __call(string $name, array $arguments) |
| 178 | 178 | { |
| 179 | - if (! isset($this->parentModel) && array_key_exists($name, $this->rootModels)) { |
|
| 179 | + if (!isset($this->parentModel) && array_key_exists($name, $this->rootModels)) { |
|
| 180 | 180 | return $this->newInstanceForModel($this->rootModels[$name]); |
| 181 | 181 | } |
| 182 | 182 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * @throws NoClientException |
| 198 | 198 | * @throws TokenException |
| 199 | 199 | */ |
| 200 | - public function __get(string $name): Collection|Model|null |
|
| 200 | + public function __get(string $name): Collection | Model | null |
|
| 201 | 201 | { |
| 202 | 202 | return match (true) { |
| 203 | 203 | $name === 'agent' => $this->newInstanceForModel(Agent::class) |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $name === 'user' => $this->newInstanceForModel(User::class) |
| 207 | 207 | ->get(extra: 'me') |
| 208 | 208 | ->first(), |
| 209 | - ! $this->parentModel && array_key_exists($name, $this->rootModels) => $this->{$name}() |
|
| 209 | + !$this->parentModel && array_key_exists($name, $this->rootModels) => $this->{$name}() |
|
| 210 | 210 | ->get(), |
| 211 | 211 | default => null, |
| 212 | 212 | }; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * @throws NoClientException |
| 246 | 246 | * @throws TokenException |
| 247 | 247 | */ |
| 248 | - public function get(array|string $properties = ['*'], ?string $extra = null): Collection|Model |
|
| 248 | + public function get(array | string $properties = ['*'], ?string $extra = null): Collection | Model |
|
| 249 | 249 | { |
| 250 | 250 | $properties = Arr::wrap($properties); |
| 251 | 251 | $count = null; |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | ->toArray() |
| 283 | 283 | ) |
| 284 | 284 | ->setClient($this->getClient()->setDebug(false))) |
| 285 | - ->setPagination(count: $count, page: $page, pageSize: $pageSize); |
|
| 285 | + ->setPagination(count : $count, page : $page, pageSize : $pageSize); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | /** |
@@ -292,11 +292,11 @@ discard block |
||
| 292 | 292 | */ |
| 293 | 293 | public function getModel(): Model |
| 294 | 294 | { |
| 295 | - if (! isset($this->class)) { |
|
| 295 | + if (!isset($this->class)) { |
|
| 296 | 296 | throw new InvalidRelationshipException(); |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - if (! isset($this->model)) { |
|
| 299 | + if (!isset($this->model)) { |
|
| 300 | 300 | $this->model = (new $this->class([], $this->parentModel))->setClient($this->client); |
| 301 | 301 | } |
| 302 | 302 | |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | $id = Arr::pull($w, $this->getModel()->getKeyName()); |
| 315 | 315 | |
| 316 | 316 | return $this->getModel() |
| 317 | - ->getPath($extra.(is_null($id) ? null : '/'.$id), $w); |
|
| 317 | + ->getPath($extra . (is_null($id) ? null : '/' . $id), $w); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | /** |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | * @throws NoClientException |
| 326 | 326 | * @throws TokenException |
| 327 | 327 | */ |
| 328 | - public function find(int|string $id, array|string $properties = ['*']): Model |
|
| 328 | + public function find(int | string $id, array | string $properties = ['*']): Model |
|
| 329 | 329 | { |
| 330 | 330 | return $this->whereId($id) |
| 331 | 331 | ->get($properties) |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | * |
| 348 | 348 | * @throws InvalidRelationshipException |
| 349 | 349 | */ |
| 350 | - public function limit(int|string $count): self |
|
| 350 | + public function limit(int | string $count): self |
|
| 351 | 351 | { |
| 352 | 352 | return $this->where('count', (int) $count); |
| 353 | 353 | } |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | * |
| 433 | 433 | * @throws InvalidRelationshipException |
| 434 | 434 | */ |
| 435 | - public function page(int|string $number, int|string|null $size = null): self |
|
| 435 | + public function page(int | string $number, int | string | null $size = null): self |
|
| 436 | 436 | { |
| 437 | 437 | return $this->where('page_no', (int) $number) |
| 438 | 438 | ->when($size, fn (self $b): self => $b->paginate($size)); |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | * |
| 444 | 444 | * @throws InvalidRelationshipException |
| 445 | 445 | */ |
| 446 | - public function pageinate(int|string|null $size = null): self |
|
| 446 | + public function pageinate(int | string | null $size = null): self |
|
| 447 | 447 | { |
| 448 | 448 | return $this->paginate($size); |
| 449 | 449 | } |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | * |
| 454 | 454 | * @throws InvalidRelationshipException |
| 455 | 455 | */ |
| 456 | - public function paginate(int|string|null $size = null): self |
|
| 456 | + public function paginate(int | string | null $size = null): self |
|
| 457 | 457 | { |
| 458 | 458 | return $this->unless($size, fn (self $b): self => $b->where('pageinate', false)) |
| 459 | 459 | ->when($size, fn (self $b): self => $b->where('pageinate', true)->where('page_size', (int) $size)); |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | */ |
| 500 | 500 | public function setClass(string $class): self |
| 501 | 501 | { |
| 502 | - if (! class_exists($class)) { |
|
| 502 | + if (!class_exists($class)) { |
|
| 503 | 503 | throw new ModelNotFoundException(sprintf('The model [%s] not found.', $class)); |
| 504 | 504 | } |
| 505 | 505 | |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | * |
| 524 | 524 | * @throws InvalidRelationshipException |
| 525 | 525 | */ |
| 526 | - public function take(int|string $count): self |
|
| 526 | + public function take(int | string $count): self |
|
| 527 | 527 | { |
| 528 | 528 | return $this->limit($count); |
| 529 | 529 | } |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | * |
| 548 | 548 | * @throws InvalidRelationshipException |
| 549 | 549 | */ |
| 550 | - public function whereId(int|string|null $id): self |
|
| 550 | + public function whereId(int | string | null $id): self |
|
| 551 | 551 | { |
| 552 | 552 | return $this->where($this->getModel()->getKeyName(), $id); |
| 553 | 553 | } |