Skip to content

Commit

Permalink
Merge pull request #6 from festivalslab/support-php81
Browse files Browse the repository at this point in the history
Support PHP 8.1 and PHP 8.2
  • Loading branch information
craig410 authored Oct 25, 2022
2 parents 17f8779 + 918c4ad commit 97bb5b7
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 22 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ jobs:
fail-fast: false
matrix:
php_version:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
dependencies:
- 'default'
include:
- php_version: '7.4'
dependencies: 'lowest'
- php_version: '8.0'
dependencies: 'lowest'
- php_version: '8.1'
dependencies: 'lowest'
- php_version: '8.2'
dependencies: 'lowest'
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
### Unreleased

### v2.1.0 (2022-10-25)

* Drop support for PHP 7.4
* Support PHP 8.1 & 8.2

### v2.0.0 (2021-10-12)

* Drop support for php 7.2
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
}
],
"require": {
"guzzlehttp/guzzle": "^6.2 || ^7.0",
"php": "^7.4 || ~8.0.0"
"guzzlehttp/guzzle": "^7.0",
"php": "~8.0.0 || ~8.1.0 || ~8.2.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^9.5.5",
"johnkary/phpunit-speedtrap": "^3.3"
},
"support": {
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
convertDeprecationsToExceptions="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
Expand Down
4 changes: 1 addition & 3 deletions src/EventSearchIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

class EventSearchIterator implements IteratorAggregate
{
protected FestivalsApiClient $client;

protected EventSearchResult $last_result;

Expand All @@ -28,9 +27,8 @@ class EventSearchIterator implements IteratorAggregate

protected int $request_count = 0;

public function __construct(FestivalsApiClient $client)
public function __construct(protected FestivalsApiClient $client)
{
$this->client = $client;
}

/**
Expand Down
10 changes: 3 additions & 7 deletions src/FestivalsApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,10 @@ class FestivalsApiClient

protected string $base_url;

protected Client $guzzle;

protected string $secret;

public function __construct(Client $guzzle, string $base_url = self::BASE_URL)
public function __construct(protected Client $guzzle, string $base_url = self::BASE_URL)
{
$this->guzzle = $guzzle;
$this->setBaseUrl($base_url);
}

Expand Down Expand Up @@ -90,9 +87,8 @@ public function setCredentials(string $access_key, string $secret): void
protected function createRequest(string $url): Request
{
$full_url = $this->base_url.$this->getSignedUrl($url);
$request = new Request('GET', $full_url);

return $request;
return new Request('GET', $full_url);
}

protected function decodeJsonResponse(ResponseInterface $response): array
Expand All @@ -114,7 +110,7 @@ protected function getSignature(string $data): string
*/
protected function getSignedUrl(string $url): string
{
if (strpos($url, '?') !== FALSE) {
if (str_contains($url, '?')) {
$url .= '&key='.$this->access_key;
} else {
$url .= '?key='.$this->access_key;
Expand Down
8 changes: 2 additions & 6 deletions src/FestivalsApiClientException.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,13 @@

class FestivalsApiClientException extends RuntimeException
{

protected ?string $url;

public function __construct(
string $message,
?int $code = NULL,
?string $url = NULL,
int $code = 0,
protected ?string $url = NULL,
?Exception $previous_exception = NULL
) {
parent::__construct($message, $code, $previous_exception);
$this->url = $url;
}

public static function invalidJsonResponse(int $code, ?Exception $previous_exception = NULL): FestivalsApiClientException
Expand Down

0 comments on commit 97bb5b7

Please sign in to comment.