/** * Fetches a cookie. * * @param string $key * * @return CookieInterface */ public function fetch(string $key) : CookieInterface { $properties = $this->collection->fetch($key, null); if (!$properties) { throw new UndefinedCookieException("Cannot fetch cookie: {$key}"); } return new Cookie($key, $properties['value']); }
private function processContentLength() { $length = strlen($this->content()); if (!$this->headers->has('Content-Length') || $this->headers->fetch('Content-Length') != $length) { $this->headers->write('Content-Length', $length); } }