예제 #1
0
 /**
  * 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']);
 }
예제 #2
0
 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);
     }
 }