|
|
@@ -25,7 +25,7 @@
|
|
|
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
|
|
* @license http://framework.zend.com/license/new-bsd New BSD License
|
|
|
*/
|
|
|
-class Zend_Paginator_SerializableLimitIterator extends LimitIterator implements Serializable
|
|
|
+class Zend_Paginator_SerializableLimitIterator extends LimitIterator implements Serializable, ArrayAccess
|
|
|
{
|
|
|
|
|
|
/**
|
|
|
@@ -80,4 +80,62 @@ class Zend_Paginator_SerializableLimitIterator extends LimitIterator implements
|
|
|
$this->seek($dataArr['pos']+$dataArr['offset']);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Returns value of the Iterator
|
|
|
+ *
|
|
|
+ * @param int $offset
|
|
|
+ * @return mixed
|
|
|
+ */
|
|
|
+ public function offsetGet($offset)
|
|
|
+ {
|
|
|
+ $currentOffset = $this->key();
|
|
|
+ $this->seek($offset);
|
|
|
+ $current = $this->current();
|
|
|
+ $this->seek($currentOffset);
|
|
|
+ return $current;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Does nothing
|
|
|
+ * Required by the ArrayAccess implementation
|
|
|
+ *
|
|
|
+ * @param int $offset
|
|
|
+ * @param mixed $value
|
|
|
+ */
|
|
|
+ public function offsetSet($offset, $value)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Determine if a value of Iterator is set and is not NULL
|
|
|
+ *
|
|
|
+ * @param int $offset
|
|
|
+ */
|
|
|
+ public function offsetExists($offset)
|
|
|
+ {
|
|
|
+ if ($offset > 0 && $offset < $this->_count) {
|
|
|
+ try {
|
|
|
+ $currentOffset = $this->key();
|
|
|
+ $this->seek($offset);
|
|
|
+ $current = $this->current();
|
|
|
+ $this->seek($currentOffset);
|
|
|
+ return null !== $current;
|
|
|
+ } catch (OutOfBoundsException $e) {
|
|
|
+ // reset position in case of exception is assigned null
|
|
|
+ $this->seek($currentOffset);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Does nothing
|
|
|
+ * Required by the ArrayAccess implementation
|
|
|
+ *
|
|
|
+ * @param int $offset
|
|
|
+ */
|
|
|
+ public function offsetUnset($offset)
|
|
|
+ {
|
|
|
+ }
|
|
|
}
|