Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
class PlIteratorUtils
{
+ /** Builds a new empty iterator
+ */
+ public static function emptyIterator()
+ {
+ return new PlEmptyIterator();
+ }
+
/** Build an iterator over an array.
* @param array The array.
* @param depth The depth of iteration.
}
}
+/** Empty iterator
+ */
+class PlEmptyIterator implements PlIterator
+{
+ public function first()
+ {
+ return false;
+ }
+
+ public function last()
+ {
+ return false;
+ }
+
+ public function next()
+ {
+ return null;
+ }
+
+ public function total()
+ {
+ return 0;
+ }
+}
+
/** Iterates over an array.
*/
class PlArrayIterator implements PlIterator