From a4ccfc2b674bb700e42bbf4f5faa9ac6d281af2a Mon Sep 17 00:00:00 2001
From: Paul Water
Date: Tue, 28 Apr 2020 03:50:35 +0200
Subject: [PATCH] Fix issues.
---
src/Endpoint/Endpoint.php | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/Endpoint/Endpoint.php b/src/Endpoint/Endpoint.php
index 39f3b2a..b2be5aa 100644
--- a/src/Endpoint/Endpoint.php
+++ b/src/Endpoint/Endpoint.php
@@ -69,6 +69,10 @@ protected function restDelete(array $path, ?array $query = null): void
protected function restGet(array $path, ?array $query = null): BaseResource
{
$result = $this->client->performHttpCall(ClubCollectApiClient::HTTP_GET, $path, $query);
+ if ($result===null)
+ {
+ throw new ClubCollectApiException('Null response received from ClubCollect');
+ }
return $this->createResourceObject($result);
}
@@ -89,6 +93,11 @@ protected function restGetList(string $key, array $path, ?array $query = null):
{
$list = [];
$result = $this->client->performHttpCall(ClubCollectApiClient::HTTP_GET, $path, $query);
+ if ($result===null)
+ {
+ throw new ClubCollectApiException('Null response received from ClubCollect');
+ }
+
foreach ($result[$key] as $import)
{
$list[] = $this->createResourceObject($import);
@@ -121,6 +130,10 @@ protected function restGetPages(string $key, ?int $from, ?int $to, array $path,
$query['page_number'] = $page;
$result = $this->client->performHttpCall(ClubCollectApiClient::HTTP_GET, $path, $query);
+ if ($result===null)
+ {
+ throw new ClubCollectApiException('Null response received from ClubCollect');
+ }
foreach ($result[$key] as $import)
{
@@ -167,6 +180,10 @@ protected function restPost(array $path, ?array $query = null, ?array $body = nu
protected function restPut(array $path, ?array $query = null, ?array $body = null): BaseResource
{
$result = $this->client->performHttpCall(ClubCollectApiClient::HTTP_PUT, $path, $query, $body);
+ if ($result===null)
+ {
+ throw new ClubCollectApiException('Null response received from ClubCollect');
+ }
return $this->createResourceObject($result);
}