Skip to content

Commit

Permalink
Apply code improvements by Rector
Browse files Browse the repository at this point in the history
  • Loading branch information
sprain committed Oct 11, 2023
1 parent f180459 commit 9a436a8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/ApiClient/Http/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

final class Client implements ClientInterface
{
private GuzzleClient $guzzle;
private readonly GuzzleClient $guzzle;

public function __construct()
{
Expand Down
6 changes: 3 additions & 3 deletions lib/ApiClient/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function getStatusCode(): int

public function getContent(): array
{
return json_decode($this->content, true);
return json_decode($this->content, true, 512, JSON_THROW_ON_ERROR);
}

public function getHeaders(): array
Expand Down Expand Up @@ -80,8 +80,8 @@ private function getLastElementOfLocationHeader(): ?string
private function getLocationHeaderContent(): ?string
{
foreach($this->getHeaders() as $header) {
if (str_starts_with(strtolower($header), 'location:')) {
return trim(preg_replace('/^.+?:/', '', $header));
if (str_starts_with(strtolower((string) $header), 'location:')) {
return trim(preg_replace('/^.+?:/', '', (string) $header));
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/ApiClient/TicketparkApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class TicketparkApiClient
{
public const ROOT_URL = 'https://api.ticketpark.ch';
final public const ROOT_URL = 'https://api.ticketpark.ch';
private const REFRESH_TOKEN_LIFETIME = 30 * 86400;

private ?ClientInterface $client = null;
Expand Down

0 comments on commit 9a436a8

Please sign in to comment.