@@ -30,7 +30,7 @@ |
||
| 30 | 30 | /** |
| 31 | 31 | * Creates a new Query Params value object, with the newly added param, and the existing params. |
| 32 | 32 | */ |
| 33 | - public function withParam(string $name, string|int $value): self |
|
| 33 | + public function withParam(string $name, string | int $value): self |
|
| 34 | 34 | { |
| 35 | 35 | return new self([ |
| 36 | 36 | ...$this->params, |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | * |
| 23 | 23 | * @throws ErrorException|UnserializableResponse|TransporterException |
| 24 | 24 | */ |
| 25 | - public function requestObject(Payload $payload): array|string; |
|
| 25 | + public function requestObject(Payload $payload): array | string; |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * Sends a content request to a server. |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | private function makeStreamHandler(ClientInterface $client): Closure |
| 119 | 119 | { |
| 120 | - if (! is_null($this->streamHandler)) { |
|
| 120 | + if (!is_null($this->streamHandler)) { |
|
| 121 | 121 | return $this->streamHandler; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | return fn (RequestInterface $request): ResponseInterface => $client->sendRequest($request); // @phpstan-ignore-line |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - return function (RequestInterface $_): never { |
|
| 132 | + return function(RequestInterface $_): never { |
|
| 133 | 133 | throw new Exception('To use stream requests you must provide an stream handler closure via the OpenAI factory.'); |
| 134 | 134 | }; |
| 135 | 135 | } |
@@ -53,7 +53,6 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | - |
|
| 57 | 56 | */ |
| 58 | 57 | public function classPasses(): ClassPasses |
| 59 | 58 | { |
@@ -66,16 +65,14 @@ discard block |
||
| 66 | 65 | { |
| 67 | 66 | return new Events($this->transporter); |
| 68 | 67 | } |
| 69 | - /** |
|
| 70 | - |
|
| 71 | - */ |
|
| 68 | + /** |
|
| 69 | + */ |
|
| 72 | 70 | public function locations(): Locations |
| 73 | 71 | { |
| 74 | 72 | return new Locations($this->transporter); |
| 75 | 73 | } |
| 76 | 74 | /** |
| 77 | - |
|
| 78 | - */ |
|
| 75 | + */ |
|
| 79 | 76 | public function tickets(): Tickets |
| 80 | 77 | { |
| 81 | 78 | return new Tickets($this->transporter); |
@@ -75,17 +75,15 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | private array $includes = []; |
| 77 | 77 | /** |
| 78 | - |
|
| 79 | 78 | */ |
| 80 | 79 | public Ticket $ticket; |
| 81 | 80 | |
| 82 | 81 | /** |
| 83 | - |
|
| 84 | 82 | */ |
| 85 | 83 | public array $tickets = []; |
| 86 | 84 | |
| 87 | 85 | /** |
| 88 | - * |
|
| 86 | + * |
|
| 89 | 87 | */ |
| 90 | 88 | public $locations = []; |
| 91 | 89 | |
@@ -588,11 +586,11 @@ discard block |
||
| 588 | 586 | $this->logging = $level; |
| 589 | 587 | } |
| 590 | 588 | |
| 591 | - /** |
|
| 592 | - * Sets the token for all future new instances |
|
| 593 | - * @deprecated |
|
| 594 | - * @param $token string The API access token, as obtained on diffbot.com/dev. |
|
| 595 | - */ |
|
| 589 | + /** |
|
| 590 | + * Sets the token for all future new instances |
|
| 591 | + * @deprecated |
|
| 592 | + * @param $token string The API access token, as obtained on diffbot.com/dev. |
|
| 593 | + */ |
|
| 596 | 594 | public static function setToken($token) |
| 597 | 595 | { |
| 598 | 596 | $validator = new Validator(); |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | if (!$this->validator->validInclude($includeAttachments)) { |
| 277 | 277 | throw new ValidationException('includeAttachments', $includeAttachments); |
| 278 | 278 | } else { |
| 279 | - if($includeAttachments) { |
|
| 279 | + if ($includeAttachments) { |
|
| 280 | 280 | array_push($this->includes, 'attachments'); |
| 281 | 281 | } |
| 282 | 282 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | if (!$this->validator->validInclude($includeLocation)) { |
| 286 | 286 | throw new ValidationException('includeLocation', $includeLocation); |
| 287 | 287 | } else { |
| 288 | - if($includeLocation) { |
|
| 288 | + if ($includeLocation) { |
|
| 289 | 289 | array_push($this->includes, 'location'); |
| 290 | 290 | } |
| 291 | 291 | } |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | if (!$this->validator->validInclude($includeTickets)) { |
| 295 | 295 | throw new ValidationException('includeTickets', $includeTickets); |
| 296 | 296 | } else { |
| 297 | - if($includeTickets) { |
|
| 297 | + if ($includeTickets) { |
|
| 298 | 298 | array_push($this->includes, 'tickets'); |
| 299 | 299 | } |
| 300 | 300 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | if (!$this->validator->validInclude($includeTicketsEvents)) { |
| 304 | 304 | throw new ValidationException('includeTicketsEvents', $includeTicketsEvents); |
| 305 | 305 | } else { |
| 306 | - if($includeTicketsEvents) { |
|
| 306 | + if ($includeTicketsEvents) { |
|
| 307 | 307 | array_push($this->includes, 'tickets.events'); |
| 308 | 308 | } |
| 309 | 309 | } |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | if (!$this->validator->validInclude($includeTicketsClassPasses)) { |
| 313 | 313 | throw new ValidationException('includeTicketsClassPasses', $includeTicketsClassPasses); |
| 314 | 314 | } else { |
| 315 | - if($includeTicketsClassPasses) { |
|
| 315 | + if ($includeTicketsClassPasses) { |
|
| 316 | 316 | array_push($this->includes, 'tickets.class_passes'); |
| 317 | 317 | } |
| 318 | 318 | } |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | // eventTickets |
| 340 | 340 | $eventTickets = []; |
| 341 | - foreach($event->tickets as $ticket) { |
|
| 341 | + foreach ($event->tickets as $ticket) { |
|
| 342 | 342 | array_push($eventTickets, new Ticket( |
| 343 | 343 | $ticket->available, |
| 344 | 344 | $ticket->availableFrom, |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | throw new ValidationException('detail', implode(' ', $detail)); |
| 421 | 421 | } else { |
| 422 | 422 | $detail = array_unique($detail); |
| 423 | - foreach($detail as $item) { |
|
| 423 | + foreach ($detail as $item) { |
|
| 424 | 424 | if (!$this->validator->validLocation($item)) { |
| 425 | 425 | throw new ValidationException('detail', $item); |
| 426 | 426 | } |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | throw new ValidationException('location', implode(' ', $title)); |
| 448 | 448 | } else { |
| 449 | 449 | $location = array_unique($location); |
| 450 | - foreach($location as $item) { |
|
| 450 | + foreach ($location as $item) { |
|
| 451 | 451 | if (!$this->validator->validLocation($item)) { |
| 452 | 452 | throw new ValidationException('location', $item); |
| 453 | 453 | } |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | throw new ValidationException('title', implode(' ', $title)); |
| 478 | 478 | } else { |
| 479 | 479 | $title = array_unique($title); |
| 480 | - foreach($title as $item) { |
|
| 480 | + foreach ($title as $item) { |
|
| 481 | 481 | if (!$this->validator->validTitle($item)) { |
| 482 | 482 | throw new ValidationException('title', $item); |
| 483 | 483 | } |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | if (!$this->validator->validInclude($includeAttachments)) { |
| 500 | 500 | throw new ValidationException('includeAttachments', $includeAttachments); |
| 501 | 501 | } else { |
| 502 | - if($includeAttachments) { |
|
| 502 | + if ($includeAttachments) { |
|
| 503 | 503 | array_push($this->includes, 'attachments'); |
| 504 | 504 | } |
| 505 | 505 | } |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | if (!$this->validator->validInclude($includeLocation)) { |
| 509 | 509 | throw new ValidationException('includeLocation', $includeLocation); |
| 510 | 510 | } else { |
| 511 | - if($includeLocation) { |
|
| 511 | + if ($includeLocation) { |
|
| 512 | 512 | array_push($this->includes, 'location'); |
| 513 | 513 | } |
| 514 | 514 | } |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | if (!$this->validator->validInclude($includeTickets)) { |
| 518 | 518 | throw new ValidationException('includeTickets', $includeTickets); |
| 519 | 519 | } else { |
| 520 | - if($includeTickets) { |
|
| 520 | + if ($includeTickets) { |
|
| 521 | 521 | array_push($this->includes, 'tickets'); |
| 522 | 522 | } |
| 523 | 523 | } |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | if (!$this->validator->validInclude($includeTicketsEvents)) { |
| 527 | 527 | throw new ValidationException('includeTicketsEvents', $includeTicketsEvents); |
| 528 | 528 | } else { |
| 529 | - if($includeTicketsEvents) { |
|
| 529 | + if ($includeTicketsEvents) { |
|
| 530 | 530 | array_push($this->includes, 'tickets.events'); |
| 531 | 531 | } |
| 532 | 532 | } |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | if (!$this->validator->validInclude($includeTicketsClassPasses)) { |
| 536 | 536 | throw new ValidationException('includeTicketsClassPasses', $includeTicketsClassPasses); |
| 537 | 537 | } else { |
| 538 | - if($includeTicketsClassPasses) { |
|
| 538 | + if ($includeTicketsClassPasses) { |
|
| 539 | 539 | array_push($this->includes, 'tickets.class_passes'); |
| 540 | 540 | } |
| 541 | 541 | } |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | foreach ($events->data as $event) { |
| 546 | 546 | |
| 547 | 547 | $eventTickets = []; |
| 548 | - foreach($event->tickets as $ticket) { |
|
| 548 | + foreach ($event->tickets as $ticket) { |
|
| 549 | 549 | array_push($eventTickets, new Ticket( |
| 550 | 550 | $ticket->available, |
| 551 | 551 | $ticket->availableFrom, |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | public readonly null | string $additionalInfo = null, |
| 15 | 15 | public readonly string $id, |
| 16 | 16 | public readonly float | null $latitude = null, |
| 17 | - public readonly float| null $longitude = null, |
|
| 17 | + public readonly float | null $longitude = null, |
|
| 18 | 18 | public readonly null | string $mapUrl = null, |
| 19 | 19 | public readonly int | null $zoom = null |
| 20 | 20 | ) { |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | public static function from(array $attributes): self |
| 39 | 39 | { |
| 40 | 40 | $included = []; |
| 41 | - if(array_key_exists('included', $attributes)) { |
|
| 41 | + if (array_key_exists('included', $attributes)) { |
|
| 42 | 42 | $included = $attributes['included']; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | /** @var array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null} $result */ |
| 41 | 41 | $result = $this->transporter->requestObject($payload); |
| 42 | 42 | |
| 43 | - if(!array_key_exists('included', $result)) { |
|
| 43 | + if (!array_key_exists('included', $result)) { |
|
| 44 | 44 | return RetrieveResponse::from($result['data']); |
| 45 | 45 | } |
| 46 | 46 | else { |
@@ -42,8 +42,7 @@ |
||
| 42 | 42 | |
| 43 | 43 | if(!array_key_exists('included', $result)) { |
| 44 | 44 | return RetrieveResponse::from($result['data']); |
| 45 | - } |
|
| 46 | - else { |
|
| 45 | + } else { |
|
| 47 | 46 | return RetrieveResponse::from($result['data'], $result['included']); |
| 48 | 47 | } |
| 49 | 48 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | // tickets |
| 67 | 67 | $tickets = []; |
| 68 | - foreach($attributes['relationships']['tickets']['data'] as $ticket) { |
|
| 68 | + foreach ($attributes['relationships']['tickets']['data'] as $ticket) { |
|
| 69 | 69 | array_push($tickets, TicketsRetrieveResponse::from([ |
| 70 | 70 | 'attributes' => [ |
| 71 | 71 | 'available' => null, |
@@ -86,17 +86,17 @@ discard block |
||
| 86 | 86 | ])); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if(!empty($included)) { |
|
| 89 | + if (!empty($included)) { |
|
| 90 | 90 | foreach ($included as $includedData) { |
| 91 | - if($includedData['type'] === 'location' && $includedData['id'] = $location->id) { |
|
| 91 | + if ($includedData['type'] === 'location' && $includedData['id'] = $location->id) { |
|
| 92 | 92 | $location = LocationsRetrieveResponse::from($includedData); |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | //tickets |
| 97 | - foreach($tickets as $index => $ticket) { |
|
| 97 | + foreach ($tickets as $index => $ticket) { |
|
| 98 | 98 | foreach ($included as $includedData) { |
| 99 | - if($includedData['type'] === 'ticket' && $includedData['id'] = $ticket->id) { |
|
| 99 | + if ($includedData['type'] === 'ticket' && $includedData['id'] = $ticket->id) { |
|
| 100 | 100 | $tickets[$index] = TicketsRetrieveResponse::from($includedData); |
| 101 | 101 | } |
| 102 | 102 | } |