/** * Retrieve a single derived request attribute. * * Retrieves a single derived request attribute as described in * getAttributes(). If the attribute has not been previously set, returns * the default value as provided. * * This method obviates the need for a hasAttribute() method, as it allows * specifying a default value to return if the attribute is not found. * * @see getAttributes() * * @param string $name The attribute name. * @param mixed $default Default value to return if the attribute does not exist. * * @return mixed */ public function getAttribute($name, $default = null) { return $this->attributes->get($name, $default); }
/** * Get HTTP header key as originally specified. * * @param string $key The case-insensitive header name * @param mixed $default The default value if key does not exist * * @return string */ public function getOriginalKey($key, $default = null) { if ($this->has($key)) { return parent::get($this->normalizeKey($key))['originalKey']; } return $default; }