diff --git a/src/Bot/Model/Response/ListResponse.php b/src/Bot/Model/Response/ListResponse.php index d4a8e09..5d7d88f 100644 --- a/src/Bot/Model/Response/ListResponse.php +++ b/src/Bot/Model/Response/ListResponse.php @@ -28,26 +28,18 @@ use RetailCrm\Common\Serializer; */ class ListResponse implements \Iterator, \ArrayAccess, \Countable { + use CommonFields; + /** * @var array */ private $items = []; - /** - * @var array - */ - private $errors = []; - /** * @var int */ private $position = 0; - /** - * @var int $statusCode - */ - private $statusCode; - /** * ListResponse constructor. * @@ -57,10 +49,10 @@ class ListResponse implements \Iterator, \ArrayAccess, \Countable */ public function __construct($responseType, $data, $statusCode) { - $this->statusCode = $statusCode; + $this->setStatusCode($statusCode); if (isset($data['errors'])) { - $this->errors = $data['errors']; + $this->setErrors($data['errors']); } else { foreach ($data as $item) { $this->items[] = @@ -77,14 +69,6 @@ class ListResponse implements \Iterator, \ArrayAccess, \Countable return empty($this->errors); } - /** - * @return array - */ - public function getErrors() - { - return $this->errors; - } - /** * \Countable implementation * @@ -215,20 +199,4 @@ class ListResponse implements \Iterator, \ArrayAccess, \Countable { return isset($this->items[$this->position]); } - - /** - * @return int - */ - public function getStatusCode(): int - { - return $this->statusCode; - } - - /** - * @param int $statusCode - */ - public function setStatusCode(int $statusCode): void - { - $this->statusCode = $statusCode; - } }