diff --git a/src/Snowcap/Emarsys/HttpClient.php b/src/Snowcap/Emarsys/HttpClient.php index 229b7fd..fbe48d0 100644 --- a/src/Snowcap/Emarsys/HttpClient.php +++ b/src/Snowcap/Emarsys/HttpClient.php @@ -4,17 +4,18 @@ interface HttpClient { - const GET = 'GET'; - const POST = 'POST'; - const PUT = 'PUT'; - const DELETE = 'DELETE'; + const GET = 'GET'; + const POST = 'POST'; + const PUT = 'PUT'; + const DELETE = 'DELETE'; + const PATCH = 'PATCH'; - /** - * @param string $method - * @param string $uri - * @param string[] $headers - * @param array $body - * @return string - */ - public function send($method, $uri, array $headers, array $body); + /** + * @param string $method + * @param string $uri + * @param string[] $headers + * @param array $body + * @return string + */ + public function send($method, $uri, array $headers, array $body); } diff --git a/src/Snowcap/Emarsys/Response.php b/src/Snowcap/Emarsys/Response.php index 1d23cd4..48dcf23 100644 --- a/src/Snowcap/Emarsys/Response.php +++ b/src/Snowcap/Emarsys/Response.php @@ -32,15 +32,15 @@ class Response * @param array $result * @throws ClientException */ - function __construct(array $result = array()) + public function __construct(array $result = array()) { - if (!isset($result['replyCode']) || !isset($result['replyText']) || !isset($result['data'])) { + if (!isset($result['replyCode']) || !isset($result['replyText'])) { throw new ClientException('Invalid result structure'); } $this->replyCode = $result['replyCode']; $this->replyText = $result['replyText']; - $this->data = $result['data']; + $this->data = isset($result['data']) ? $result['data'] : []; } /**