1 | <?php |
||
32 | class PageIterator implements Page, \ArrayAccess { |
||
33 | |||
34 | /** |
||
35 | * |
||
36 | * @var Statement |
||
37 | */ |
||
38 | protected $statement; |
||
39 | |||
40 | protected $fetchStarted = false; |
||
41 | private $objectStorage; |
||
42 | private $className; |
||
43 | |||
44 | private $parentResult; |
||
45 | private $tdbmService; |
||
46 | private $magicSql; |
||
47 | private $parameters; |
||
48 | private $limit; |
||
49 | private $offset; |
||
50 | private $columnDescriptors; |
||
51 | private $magicQuery; |
||
52 | |||
53 | /** |
||
54 | * The key of the current retrieved object. |
||
55 | * |
||
56 | * @var int |
||
57 | */ |
||
58 | protected $key = -1; |
||
59 | |||
60 | protected $current = null; |
||
61 | |||
62 | private $databasePlatform; |
||
63 | |||
64 | private $innerResultIterator; |
||
65 | |||
66 | public function __construct(ResultIterator $parentResult, $magicSql, array $parameters, $limit, $offset, array $columnDescriptors, $objectStorage, $className, TDBMService $tdbmService, MagicQuery $magicQuery, $mode) |
||
81 | |||
82 | /** |
||
83 | * Retrieve an external iterator |
||
84 | * @link http://php.net/manual/en/iteratoraggregate.getiterator.php |
||
85 | * @return InnerResultIterator An instance of an object implementing <b>Iterator</b> or |
||
86 | * <b>Traversable</b> |
||
87 | * @since 5.0.0 |
||
88 | */ |
||
89 | public function getIterator() |
||
101 | |||
102 | /** |
||
103 | * @return int |
||
104 | */ |
||
105 | public function getCurrentOffset() |
||
109 | |||
110 | /** |
||
111 | * @return int |
||
112 | */ |
||
113 | public function getCurrentPage() |
||
117 | |||
118 | /** |
||
119 | * @return int |
||
120 | */ |
||
121 | public function getCurrentLimit() |
||
125 | |||
126 | /** |
||
127 | * Return the number of results on the current page of the {@link Result}. |
||
128 | * |
||
129 | * @return int |
||
130 | */ |
||
131 | public function count() |
||
135 | |||
136 | /** |
||
137 | * Return the number of ALL results in the paginatable of {@link Result}. |
||
138 | * |
||
139 | * @return int |
||
140 | */ |
||
141 | public function totalCount() |
||
145 | |||
146 | /** |
||
147 | * Casts the result set to a PHP array. |
||
148 | * |
||
149 | * @return array |
||
150 | */ |
||
151 | public function toArray() { |
||
154 | |||
155 | /** |
||
156 | * Returns a new iterator mapping any call using the $callable function. |
||
157 | * |
||
158 | * @param callable $callable |
||
159 | * @return MapIterator |
||
160 | */ |
||
161 | public function map(callable $callable) { |
||
164 | |||
165 | /** |
||
166 | * Whether a offset exists |
||
167 | * @link http://php.net/manual/en/arrayaccess.offsetexists.php |
||
168 | * @param mixed $offset <p> |
||
169 | * An offset to check for. |
||
170 | * </p> |
||
171 | * @return boolean true on success or false on failure. |
||
172 | * </p> |
||
173 | * <p> |
||
174 | * The return value will be casted to boolean if non-boolean was returned. |
||
175 | * @since 5.0.0 |
||
176 | */ |
||
177 | public function offsetExists($offset) |
||
181 | |||
182 | /** |
||
183 | * Offset to retrieve |
||
184 | * @link http://php.net/manual/en/arrayaccess.offsetget.php |
||
185 | * @param mixed $offset <p> |
||
186 | * The offset to retrieve. |
||
187 | * </p> |
||
188 | * @return mixed Can return all value types. |
||
189 | * @since 5.0.0 |
||
190 | */ |
||
191 | public function offsetGet($offset) |
||
195 | |||
196 | /** |
||
197 | * Offset to set |
||
198 | * @link http://php.net/manual/en/arrayaccess.offsetset.php |
||
199 | * @param mixed $offset <p> |
||
200 | * The offset to assign the value to. |
||
201 | * </p> |
||
202 | * @param mixed $value <p> |
||
203 | * The value to set. |
||
204 | * </p> |
||
205 | * @return void |
||
206 | * @since 5.0.0 |
||
207 | */ |
||
208 | public function offsetSet($offset, $value) |
||
212 | |||
213 | /** |
||
214 | * Offset to unset |
||
215 | * @link http://php.net/manual/en/arrayaccess.offsetunset.php |
||
216 | * @param mixed $offset <p> |
||
217 | * The offset to unset. |
||
218 | * </p> |
||
219 | * @return void |
||
220 | * @since 5.0.0 |
||
221 | */ |
||
222 | public function offsetUnset($offset) |
||
226 | } |
||
227 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: