1 | <?php |
||
30 | class InnerResultIterator implements \Iterator, \Countable, \ArrayAccess |
||
31 | { |
||
32 | /** |
||
33 | * @var Statement |
||
34 | */ |
||
35 | protected $statement; |
||
36 | |||
37 | protected $fetchStarted = false; |
||
38 | private $objectStorage; |
||
39 | private $className; |
||
40 | |||
41 | private $tdbmService; |
||
42 | private $magicSql; |
||
43 | private $parameters; |
||
44 | private $limit; |
||
45 | private $offset; |
||
46 | private $columnDescriptors; |
||
47 | private $magicQuery; |
||
48 | |||
49 | /** |
||
50 | * The key of the current retrieved object. |
||
51 | * |
||
52 | * @var int |
||
53 | */ |
||
54 | protected $key = -1; |
||
55 | |||
56 | protected $current = null; |
||
57 | |||
58 | private $databasePlatform; |
||
59 | |||
60 | /** |
||
61 | * @var LoggerInterface |
||
62 | */ |
||
63 | private $logger; |
||
64 | |||
65 | public function __construct($magicSql, array $parameters, $limit, $offset, array $columnDescriptors, $objectStorage, $className, TDBMService $tdbmService, MagicQuery $magicQuery, LoggerInterface $logger) |
||
66 | { |
||
67 | $this->magicSql = $magicSql; |
||
68 | $this->objectStorage = $objectStorage; |
||
69 | $this->className = $className; |
||
70 | $this->tdbmService = $tdbmService; |
||
71 | $this->parameters = $parameters; |
||
72 | $this->limit = $limit; |
||
73 | $this->offset = $offset; |
||
74 | $this->columnDescriptors = $columnDescriptors; |
||
75 | $this->magicQuery = $magicQuery; |
||
76 | $this->databasePlatform = $this->tdbmService->getConnection()->getDatabasePlatform(); |
||
77 | $this->logger = $logger; |
||
78 | } |
||
79 | |||
80 | protected function executeQuery() |
||
91 | |||
92 | /** |
||
93 | * Counts found records (this is the number of records fetched, taking into account the LIMIT and OFFSET settings). |
||
94 | * |
||
95 | * @return int |
||
96 | */ |
||
97 | public function count() |
||
105 | |||
106 | /** |
||
107 | * Fetches record at current cursor. |
||
108 | * |
||
109 | * @return AbstractTDBMObject|null |
||
110 | */ |
||
111 | public function current() |
||
115 | |||
116 | /** |
||
117 | * Returns the current result's key. |
||
118 | * |
||
119 | * @return int |
||
120 | */ |
||
121 | public function key() |
||
125 | |||
126 | /** |
||
127 | * Advances the cursor to the next result. |
||
128 | * Casts the database result into one (or several) beans. |
||
129 | */ |
||
130 | public function next() |
||
206 | |||
207 | /** |
||
208 | * Moves the cursor to the beginning of the result set. |
||
209 | */ |
||
210 | public function rewind() |
||
216 | /** |
||
217 | * Checks if the cursor is reading a valid result. |
||
218 | * |
||
219 | * @return bool |
||
220 | */ |
||
221 | public function valid() |
||
225 | |||
226 | /** |
||
227 | * Whether a offset exists. |
||
228 | * |
||
229 | * @link http://php.net/manual/en/arrayaccess.offsetexists.php |
||
230 | * |
||
231 | * @param mixed $offset <p> |
||
232 | * An offset to check for. |
||
233 | * </p> |
||
234 | * |
||
235 | * @return bool true on success or false on failure. |
||
236 | * </p> |
||
237 | * <p> |
||
238 | * The return value will be casted to boolean if non-boolean was returned |
||
239 | * |
||
240 | * @since 5.0.0 |
||
241 | */ |
||
242 | public function offsetExists($offset) |
||
246 | |||
247 | /** |
||
248 | * Offset to retrieve. |
||
249 | * |
||
250 | * @link http://php.net/manual/en/arrayaccess.offsetget.php |
||
251 | * |
||
252 | * @param mixed $offset <p> |
||
253 | * The offset to retrieve. |
||
254 | * </p> |
||
255 | * |
||
256 | * @return mixed Can return all value types |
||
257 | * |
||
258 | * @since 5.0.0 |
||
259 | */ |
||
260 | public function offsetGet($offset) |
||
264 | |||
265 | /** |
||
266 | * Offset to set. |
||
267 | * |
||
268 | * @link http://php.net/manual/en/arrayaccess.offsetset.php |
||
269 | * |
||
270 | * @param mixed $offset <p> |
||
271 | * The offset to assign the value to. |
||
272 | * </p> |
||
273 | * @param mixed $value <p> |
||
274 | * The value to set. |
||
275 | * </p> |
||
276 | * |
||
277 | * @since 5.0.0 |
||
278 | */ |
||
279 | public function offsetSet($offset, $value) |
||
283 | |||
284 | /** |
||
285 | * Offset to unset. |
||
286 | * |
||
287 | * @link http://php.net/manual/en/arrayaccess.offsetunset.php |
||
288 | * |
||
289 | * @param mixed $offset <p> |
||
290 | * The offset to unset. |
||
291 | * </p> |
||
292 | * |
||
293 | * @since 5.0.0 |
||
294 | */ |
||
295 | public function offsetUnset($offset) |
||
299 | } |
||
300 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.