Esempio n. 1
0
 /**
  * Get value of HTTP cookie from the current HTTP request
  *
  * Return the value of a cookie from the current HTTP request,
  * or return NULL if cookie does not exist. Cookies created during
  * the current request will not be available until the next request.
  *
  * @param  string      $name
  * @param  bool        $deleteIfInvalid
  * @return string|null
  */
 public function getCookie($name, $deleteIfInvalid = true)
 {
     // Get cookie value
     $value = $this->request->cookies->get($name);
     // Decode if encrypted
     if ($this->config('cookies.encrypt')) {
         $value = \Pulse\Http\Util::decodeSecureCookie($value, $this->config('cookies.secret_key'), $this->config('cookies.cipher'), $this->config('cookies.cipher_mode'));
         if ($value === false && $deleteIfInvalid) {
             $this->deleteCookie($name);
         }
     }
     return $value;
 }