/** * (PHP 5 >= 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); }
/** * @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); }
/** * 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); }
/** * 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; } }
public function offsetGet($offset) { $this->load(); return parent::offsetGet($offset); }
/** * 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); }