1 | <?php |
||
20 | class Cursor implements CursorInterface |
||
21 | { |
||
22 | /** |
||
23 | * Current cursor value. |
||
24 | * |
||
25 | * @var mixed |
||
26 | */ |
||
27 | protected $current; |
||
28 | |||
29 | /** |
||
30 | * Previous cursor value. |
||
31 | * |
||
32 | * @var mixed |
||
33 | */ |
||
34 | protected $prev; |
||
35 | |||
36 | /** |
||
37 | * Next cursor value. |
||
38 | * |
||
39 | * @var mixed |
||
40 | */ |
||
41 | protected $next; |
||
42 | |||
43 | /** |
||
44 | * Items being held for the current cursor position. |
||
45 | * |
||
46 | * @var int |
||
47 | */ |
||
48 | protected $count; |
||
49 | |||
50 | /** |
||
51 | * Create a new Cursor instance. |
||
52 | * |
||
53 | * @param int $current |
||
54 | * @param null $prev |
||
55 | * @param mixed $next |
||
56 | * @param int $count |
||
57 | * |
||
58 | * @return void |
||
59 | */ |
||
60 | 2 | public function __construct($current = null, $prev = null, $next = null, $count = null) |
|
61 | { |
||
62 | 2 | $this->current = $current; |
|
63 | 2 | $this->prev = $prev; |
|
64 | 2 | $this->next = $next; |
|
65 | 2 | $this->count = $count; |
|
66 | 2 | } |
|
67 | |||
68 | /** |
||
69 | * Get the current cursor value. |
||
70 | * |
||
71 | * @return mixed |
||
72 | */ |
||
73 | 2 | public function getCurrent() |
|
74 | { |
||
75 | 2 | return $this->current; |
|
76 | } |
||
77 | |||
78 | /** |
||
79 | * Set the current cursor value. |
||
80 | * |
||
81 | * @param int $current |
||
82 | * |
||
83 | * @return Cursor |
||
84 | */ |
||
85 | 1 | public function setCurrent($current) |
|
86 | { |
||
87 | 1 | $this->current = $current; |
|
88 | |||
89 | 1 | return $this; |
|
90 | } |
||
91 | |||
92 | /** |
||
93 | * Get the prev cursor value. |
||
94 | * |
||
95 | * @return mixed |
||
96 | */ |
||
97 | 2 | public function getPrev() |
|
98 | { |
||
99 | 2 | return $this->prev; |
|
100 | } |
||
101 | |||
102 | /** |
||
103 | * Set the prev cursor value. |
||
104 | * |
||
105 | * @param int $prev |
||
106 | * |
||
107 | * @return Cursor |
||
108 | */ |
||
109 | 1 | public function setPrev($prev) |
|
110 | { |
||
111 | 1 | $this->prev = $prev; |
|
112 | |||
113 | 1 | return $this; |
|
114 | } |
||
115 | |||
116 | /** |
||
117 | * Get the next cursor value. |
||
118 | * |
||
119 | * @return mixed |
||
120 | */ |
||
121 | 2 | public function getNext() |
|
122 | { |
||
123 | 2 | return $this->next; |
|
124 | } |
||
125 | |||
126 | /** |
||
127 | * Set the next cursor value. |
||
128 | * |
||
129 | * @param int $next |
||
130 | * |
||
131 | * @return Cursor |
||
132 | */ |
||
133 | 1 | public function setNext($next) |
|
134 | { |
||
135 | 1 | $this->next = $next; |
|
136 | |||
137 | 1 | return $this; |
|
138 | } |
||
139 | |||
140 | /** |
||
141 | * Returns the total items in the current cursor. |
||
142 | * |
||
143 | * @return int |
||
144 | */ |
||
145 | 2 | public function getCount() |
|
149 | |||
150 | /** |
||
151 | * Set the total items in the current cursor. |
||
152 | * |
||
153 | * @param int $count |
||
154 | * |
||
155 | * @return Cursor |
||
156 | */ |
||
157 | 1 | public function setCount($count) |
|
163 | } |
||
164 |