/** * Get a cookie from this container. * @param string $key * String reference to get from the container * @return mixed * Mixed value from the container */ public function offsetGet($key) { if (!isset($this->fresh[$key]) && !isset($this->existing[$key])) { throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $key)); } $cookie = $this->fresh->offsetExists($key) ? $this->fresh->offsetGet($key) : null; $cookie = is_null($cookie) && $this->existing->offsetExists($key) ? $this->existing->offsetGet($key) : $cookie; return $cookie; }
/** * Gets a parameter or the closure defining an object. * @param string $key The unique identifier for the parameter or object * @return mixed The value of the parameter or the closure defining an object * @throws \InvalidArgumentException if the identifier is not defined */ public function raw($key) { if (!isset($this->keys[$key])) { throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $key)); } if (isset($this->raw[$key])) { return $this->raw[$key]; } return parent::offsetGet($key); }