| Total Complexity | 5 |
| Total Lines | 68 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | class ResponseCollection extends Response implements ResponseCollectionInterface |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * @var int |
||
| 23 | */ |
||
| 24 | protected $count; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var int |
||
| 28 | */ |
||
| 29 | protected $total; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @var string |
||
| 33 | */ |
||
| 34 | protected $nextCursor; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @var array |
||
| 38 | */ |
||
| 39 | protected $results; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * ResponseCollection constructor. |
||
| 43 | * |
||
| 44 | * @param GuzzleResponseInterface $response |
||
| 45 | */ |
||
| 46 | 1 | public function __construct(GuzzleResponseInterface $response) |
|
| 47 | { |
||
| 48 | 1 | parent::__construct($response); |
|
| 49 | 1 | $this->count = (int) $this->popField('objectsCount'); |
|
| 50 | 1 | $this->total = (int) $this->popField('totalCount'); |
|
| 51 | 1 | $this->nextCursor = $this->popField('nextCursorId'); |
|
| 52 | 1 | $this->results = (array) $this->popField('results'); |
|
| 53 | 1 | } |
|
| 54 | |||
| 55 | /** |
||
| 56 | * {@inheritdoc} |
||
| 57 | */ |
||
| 58 | 1 | public function getData() |
|
| 59 | { |
||
| 60 | 1 | return new Collection($this->results); |
|
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @return int |
||
| 65 | */ |
||
| 66 | 1 | public function getCount() |
|
| 69 | } |
||
| 70 | |||
| 71 | /** |
||
| 72 | * @return int |
||
| 73 | */ |
||
| 74 | 1 | public function getTotal() |
|
| 75 | { |
||
| 76 | 1 | return $this->total; |
|
| 77 | } |
||
| 78 | |||
| 79 | /** |
||
| 80 | * The cursor for the next set of results, if this is null there are no more results. |
||
| 81 | * |
||
| 82 | * @return string|null |
||
| 83 | */ |
||
| 84 | 1 | public function getNextCursor() |
|
| 87 | } |
||
| 88 | } |
||
| 89 |