1 | <?php |
||
24 | class Collection extends ResourceAbstract |
||
25 | { |
||
26 | /** |
||
27 | * A collection of data. |
||
28 | * |
||
29 | * @var array|ArrayIterator |
||
30 | */ |
||
31 | protected $data; |
||
32 | |||
33 | /** |
||
34 | * A the paginator instance. |
||
35 | * |
||
36 | * @var PaginatorInterface |
||
37 | */ |
||
38 | protected $paginator; |
||
39 | |||
40 | /** |
||
41 | * The cursor instance. |
||
42 | * |
||
43 | * @var CursorInterface |
||
44 | */ |
||
45 | protected $cursor; |
||
46 | |||
47 | /** |
||
48 | * Get the paginator instance. |
||
49 | * |
||
50 | * @return PaginatorInterface |
||
51 | */ |
||
52 | 5 | public function getPaginator() |
|
56 | |||
57 | /** |
||
58 | * Determine if the resource has a paginator implementation. |
||
59 | * |
||
60 | * @return bool |
||
61 | */ |
||
62 | 23 | public function hasPaginator() |
|
63 | { |
||
64 | 23 | return $this->paginator instanceof PaginatorInterface; |
|
65 | } |
||
66 | |||
67 | /** |
||
68 | * Get the cursor instance. |
||
69 | * |
||
70 | * @return CursorInterface |
||
71 | */ |
||
72 | 2 | public function getCursor() |
|
73 | { |
||
74 | 2 | return $this->cursor; |
|
75 | } |
||
76 | |||
77 | /** |
||
78 | * Determine if the resource has a cursor implementation. |
||
79 | * |
||
80 | * @return bool |
||
81 | */ |
||
82 | 24 | public function hasCursor() |
|
83 | { |
||
84 | 24 | return $this->cursor instanceof CursorInterface; |
|
85 | } |
||
86 | |||
87 | /** |
||
88 | * Set the paginator instance. |
||
89 | * |
||
90 | * @param PaginatorInterface $paginator |
||
91 | * |
||
92 | * @return $this |
||
93 | */ |
||
94 | 5 | public function setPaginator(PaginatorInterface $paginator) |
|
100 | |||
101 | /** |
||
102 | * Set the cursor instance. |
||
103 | * |
||
104 | * @param CursorInterface $cursor |
||
105 | * |
||
106 | * @return $this |
||
107 | */ |
||
108 | 2 | public function setCursor(CursorInterface $cursor) |
|
114 | } |
||
115 |