mediamonks /
php-rest-api
| 1 | <?php |
||
| 2 | |||
| 3 | namespace MediaMonks\RestApi\Response; |
||
| 4 | |||
| 5 | class CursorPaginatedResponse extends AbstractPaginatedResponse implements PaginatedResponseInterface |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var mixed |
||
| 9 | */ |
||
| 10 | protected $before; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @var mixed |
||
| 14 | */ |
||
| 15 | protected $after; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param $data |
||
| 19 | * @param $before |
||
| 20 | * @param $after |
||
| 21 | * @param $limit |
||
| 22 | * @param null $total |
||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
| 23 | */ |
||
| 24 | 5 | public function __construct($data, $before, $after, $limit, $total = null) |
|
| 25 | { |
||
| 26 | 5 | parent::__construct($data, $limit, $total); |
|
| 27 | 5 | $this->before = $before; |
|
| 28 | 5 | $this->after = $after; |
|
| 29 | 5 | } |
|
| 30 | |||
| 31 | /** |
||
| 32 | * @return mixed |
||
| 33 | */ |
||
| 34 | 5 | public function getBefore() |
|
| 35 | { |
||
| 36 | 5 | return $this->before; |
|
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @param mixed $before |
||
| 41 | */ |
||
| 42 | 1 | public function setBefore($before) |
|
| 43 | { |
||
| 44 | 1 | $this->before = $before; |
|
| 45 | 1 | } |
|
| 46 | |||
| 47 | /** |
||
| 48 | * @return mixed |
||
| 49 | */ |
||
| 50 | 5 | public function getAfter() |
|
| 51 | { |
||
| 52 | 5 | return $this->after; |
|
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @param mixed $after |
||
| 57 | */ |
||
| 58 | 1 | public function setAfter($after) |
|
| 59 | { |
||
| 60 | 1 | $this->after = $after; |
|
| 61 | 1 | } |
|
| 62 | |||
| 63 | /** |
||
| 64 | * @return array |
||
| 65 | */ |
||
| 66 | 3 | public function toArray() |
|
| 67 | { |
||
| 68 | $data = [ |
||
| 69 | 3 | 'before' => $this->getBefore(), |
|
| 70 | 3 | 'after' => $this->getAfter(), |
|
| 71 | 3 | 'limit' => $this->getLimit(), |
|
| 72 | 3 | ]; |
|
| 73 | 3 | if (!is_null($this->getTotal())) { |
|
| 74 | 2 | $data['total'] = $this->getTotal(); |
|
| 75 | 2 | } |
|
| 76 | |||
| 77 | 3 | return $data; |
|
| 78 | } |
||
| 79 | } |
||
| 80 |