Exemple #1
0
 /**
  * (PHP 5 &gt;= 5.0.0)<br/>
  * Offset to retrieve
  * @link http://php.net/manual/en/arrayaccess.offsetget.php
  * @param int $index <p>
  * The offset to retrieve.
  * </p>
  * @return mixed Can return all value types.
  */
 public function &offsetGet($index)
 {
     if (!$this->offsetExists($index)) {
         $this->offsetSet($index, $this->getDefault());
     }
     return parent::offsetGet($index);
 }
Exemple #2
0
 /**
  * @param int|string $offset
  *
  * @return mixed
  */
 public function offsetGet($offset)
 {
     if (!$this->offsetExists($offset)) {
         $class = __NAMESPACE__ . '\\' . $this->type . 'Model';
         $item = new $class(array($this->parentId, $offset), 'id');
         parent::offsetSet($offset, $item);
     }
     return parent::offsetGet($offset);
 }
Exemple #3
0
 /**
  * Returns item (\ArrayAccess implementation).
  * @param  int index
  * @return mixed
  * @throws ArgumentOutOfRangeException
  */
 public function offsetGet($index)
 {
     $index -= $this->base;
     if ($index < 0 || $index >= count($this)) {
         throw new ArgumentOutOfRangeException();
     }
     return parent::offsetGet($index);
 }
Exemple #4
0
 /**
  * Returns item (\ArrayAccess implementation).
  * @param  string key
  * @return mixed
  * @throws KeyNotFoundException, \InvalidArgumentException
  */
 public function offsetGet($key)
 {
     if (!is_scalar($key)) {
         throw new InvalidArgumentException("Key must be either a string or an integer, " . gettype($key) . " given.");
     }
     if (parent::offsetExists($key)) {
         return parent::offsetGet($key);
     } elseif ($this->throwKeyNotFound) {
         throw new KeyNotFoundException();
     } else {
         return NULL;
     }
 }
Exemple #5
0
 public function offsetGet($offset)
 {
     $this->load();
     return parent::offsetGet($offset);
 }
Exemple #6
0
 /**
  * Returns item (\ArrayAccess implementation).
  * @param  int index
  * @return mixed
  * @throws \ArgumentOutOfRangeException
  */
 public function offsetGet($index)
 {
     if (!$this->isLoaded() && $this->isLoadable()) {
         $this->load();
     }
     return parent::offsetGet($index);
 }