/** * @param mixed $key * @return ServiceInterface * @throws ServiceNotFoundInCollectionException */ public function offsetGet($key) { if (!isset($this->items[$key])) { throw new ServiceNotFoundInCollectionException("Service with key '{$key}' not found in collection"); } return parent::offsetGet($key); }
/** * @param $type * @return IJobHandler * @throws HandlerException */ public function getHandlerForType($type) { if ($this->hasHandlerForType($type)) { return $this->handlers->offsetGet($type); } throw new HandlerException("No handler of type {$type} exists."); }
/** * Get defaults settings. * * @param string|null $key A setting key (optional) * * @return array * * @throws \Subbly\Api\Service\Exception * * @api */ public function defaults($key = null) { if (is_string($key)) { if (!$this->has($key)) { throw new Exception(sprintf(Exception::SETTING_KEY_NOT_EXISTS, $key)); } return $this->defaults->offsetGet($key); } return $this->defaults->toArray(); }
public function offsetUnset($key) { $keySegments = explode('.', $key); $firstKeySegment = array_shift($keySegments); if ($keySegments && $this->offsetExists($firstKeySegment)) { return parent::offsetGet($firstKeySegment)->items()->offsetUnset(implode('.', $keySegments)); } else { return parent::offsetUnset($key); } }
/** * @expectedException PHPUnit_Framework_Error_Notice */ public function testArrayAccessOffsetGetOnNonExist() { $c = new Collection(['foo', 'bar']); $c->offsetGet(1000); }
/** * @param mixed $offset * @return Record|null */ public function offsetGet($offset) { return $this->results->offsetGet($offset); }
/** * Offset to retrieve * @link http://php.net/manual/en/arrayaccess.offsetget.php * * @param mixed $offset <p> * The offset to retrieve. * </p> * * @return mixed Can return all value types. * @since 5.0.0 */ public function offsetGet($offset) { return $this->fields->offsetGet($offset); }
public function offsetGet($key) { return parent::offsetGet(strtoupper($key)); }