From 0362f2525da67a78f1719cf5bab4c01510036d40 Mon Sep 17 00:00:00 2001 From: yafniss Date: Thu, 26 Aug 2021 12:18:42 +0100 Subject: [PATCH] DARK - fix instantiate YouCanPay with the right env --- src/API/APIService.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/API/APIService.php b/src/API/APIService.php index a8f9a3a..4846c3a 100755 --- a/src/API/APIService.php +++ b/src/API/APIService.php @@ -19,9 +19,7 @@ final class APIService implements APIServiceInterface private $httpClient; public function __construct() - { - $this->initHttpClient(); - } + {} /** * @param string $endpoint @@ -67,6 +65,10 @@ public function get(string $endpoint, array $params): Response private function getHttpClient(): GuzzleClient { + if (!$this->httpClient instanceof GuzzleClient) { + $this->initHttpClient(); + } + return $this->httpClient; }