From 6bd6395a7a0b1324fbd64bf471ccff918511dc84 Mon Sep 17 00:00:00 2001 From: Vitaly Artemev Date: Tue, 6 Dec 2016 14:43:20 +0400 Subject: [PATCH] Delete RetailcrmApiResponse.php --- .../retailcrm/RetailcrmApiResponse.php | 122 ------------------ 1 file changed, 122 deletions(-) delete mode 100644 classes/modules/RetailCRM/classes/retailcrm/RetailcrmApiResponse.php diff --git a/classes/modules/RetailCRM/classes/retailcrm/RetailcrmApiResponse.php b/classes/modules/RetailCRM/classes/retailcrm/RetailcrmApiResponse.php deleted file mode 100644 index 6d169d2..0000000 --- a/classes/modules/RetailCRM/classes/retailcrm/RetailcrmApiResponse.php +++ /dev/null @@ -1,122 +0,0 @@ -statusCode = (int) $statusCode; - - if (!empty($responseBody)) { - $response = json_decode($responseBody, true); - - if (!$response && JSON_ERROR_NONE !== ($error = json_last_error())) { - throw new InvalidJsonException( - "Invalid JSON in the API response body. Error code #$error", - $error - ); - } - - $this->response = $response; - } - } - - /** - * Return HTTP response status code - * - * @return int - */ - public function getStatusCode() - { - return $this->statusCode; - } - - /** - * HTTP request was successful - * - * @return bool - */ - public function isSuccessful() - { - return $this->statusCode < 400; - } - - /** - * Allow to access for the property throw class method - * - * @param string $name - * @return mixed - */ - public function __call($name, $arguments) - { - // convert getSomeProperty to someProperty - $propertyName = strtolower(substr($name, 3, 1)) . substr($name, 4); - - if (!isset($this->response[$propertyName])) { - throw new InvalidArgumentException("Method \"$name\" not found"); - } - - return $this->response[$propertyName]; - } - - /** - * Allow to access for the property throw object property - * - * @param string $name - * @return mixed - */ - public function __get($name) - { - if (!isset($this->response[$name])) { - throw new InvalidArgumentException("Property \"$name\" not found"); - } - - return $this->response[$name]; - } - - /** - * @param mixed $offset - * @param mixed $value - */ - public function offsetSet($offset, $value) - { - throw new BadMethodCallException('This activity not allowed'); - } - - /** - * @param mixed $offset - */ - public function offsetUnset($offset) - { - throw new BadMethodCallException('This call not allowed'); - } - - /** - * @param mixed $offset - * @return bool - */ - public function offsetExists($offset) - { - return isset($this->response[$offset]); - } - - /** - * @param mixed $offset - * @return mixed - */ - public function offsetGet($offset) - { - if (!isset($this->response[$offset])) { - throw new InvalidArgumentException("Property \"$offset\" not found"); - } - - return $this->response[$offset]; - } -} \ No newline at end of file