From 5c3453260fd77713f1d25b879d3205e8745f9a57 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 07:40:43 +0000 Subject: [PATCH 1/3] Bump aglipanci/laravel-pint-action from 1.0.0 to 2.3.1 Bumps [aglipanci/laravel-pint-action](https://github.com/aglipanci/laravel-pint-action) from 1.0.0 to 2.3.1. - [Release notes](https://github.com/aglipanci/laravel-pint-action/releases) - [Commits](https://github.com/aglipanci/laravel-pint-action/compare/1.0.0...2.3.1) --- updated-dependencies: - dependency-name: aglipanci/laravel-pint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/fix-php-code-style-issues-pint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fix-php-code-style-issues-pint.yml b/.github/workflows/fix-php-code-style-issues-pint.yml index 2f32b5f..c958238 100644 --- a/.github/workflows/fix-php-code-style-issues-pint.yml +++ b/.github/workflows/fix-php-code-style-issues-pint.yml @@ -19,7 +19,7 @@ jobs: ref: ${{ github.head_ref }} - name: Fix PHP code style issues - uses: aglipanci/laravel-pint-action@1.0.0 + uses: aglipanci/laravel-pint-action@2.3.1 - name: Commit changes uses: stefanzweifel/git-auto-commit-action@v4 From 839bb3627b0d41153fc1eed38a5d4d4b63f7ab1c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 26 Aug 2024 07:41:32 +0000 Subject: [PATCH 2/3] Fix styling --- src/SkeletonClass.php | 4 +++- tests/ExampleTestPhpunit.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/SkeletonClass.php b/src/SkeletonClass.php index 7e1e5b4..dcf362c 100755 --- a/src/SkeletonClass.php +++ b/src/SkeletonClass.php @@ -2,4 +2,6 @@ namespace VendorName\Skeleton; -class SkeletonClass {} +class SkeletonClass +{ +} diff --git a/tests/ExampleTestPhpunit.php b/tests/ExampleTestPhpunit.php index 30853f0..fa301e0 100644 --- a/tests/ExampleTestPhpunit.php +++ b/tests/ExampleTestPhpunit.php @@ -4,4 +4,6 @@ use PHPUnit\Framework\TestCase; -class ExampleTest extends TestCase {} +class ExampleTest extends TestCase +{ +} From 126f726825579bb41ce24ddeab2cbc41629c07f8 Mon Sep 17 00:00:00 2001 From: Baspa Date: Mon, 26 Aug 2024 17:28:43 +0000 Subject: [PATCH 3/3] Fix styling --- src/EnergyZero.php | 14 +++++++++----- tests/ExampleTest.php | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/EnergyZero.php b/src/EnergyZero.php index c1bf042..59dd8d0 100755 --- a/src/EnergyZero.php +++ b/src/EnergyZero.php @@ -3,8 +3,8 @@ namespace Baspa\EnergyZero; use DateTime; -use Exception; use DateTimeZone; +use Exception; use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\RequestException; @@ -12,11 +12,14 @@ class EnergyZero { private bool $vat = true; + private int $requestTimeout = 10; + private string $baseUri = 'https://api.energyzero.nl/v1/'; + private ClientInterface $client; - public function __construct(ClientInterface $client = null) + public function __construct(?ClientInterface $client = null) { $this->client = $client ?? new Client([ 'base_uri' => $this->baseUri, @@ -42,10 +45,11 @@ public function request(string $uri, array $params = []): ?array if ($response->getStatusCode() === 200) { return json_decode($response->getBody()->getContents(), true); } else { - throw new Exception('Unexpected response status: ' . $response->getStatusCode()); + throw new Exception('Unexpected response status: '.$response->getStatusCode()); } } catch (RequestException $e) { - error_log('Error: ' . $e->getMessage()); + error_log('Error: '.$e->getMessage()); + return null; } } @@ -192,4 +196,4 @@ public function getValleyHours(string $startDate, string $endDate, int $topN = 5 return array_slice($prices, 0, $topN); } -} \ No newline at end of file +} diff --git a/tests/ExampleTest.php b/tests/ExampleTest.php index f61b951..1815066 100644 --- a/tests/ExampleTest.php +++ b/tests/ExampleTest.php @@ -7,7 +7,7 @@ use GuzzleHttp\Psr7\Response; beforeEach(function () { - $this->mockHandler = new MockHandler(); + $this->mockHandler = new MockHandler; $handlerStack = HandlerStack::create($this->mockHandler); $client = new Client(['handler' => $handlerStack]); $this->energyZero = new EnergyZero($client); @@ -171,4 +171,4 @@ ['readingDate' => '2023-05-01T00:00:00', 'price' => 0.1], ['readingDate' => '2023-05-01T02:00:00', 'price' => 0.2], ]); -}); \ No newline at end of file +});