Symfony\Component\HttpFoundation\Request::hasPreviousSession PHP Method

hasPreviousSession() public method

Whether the request contains a Session which was started in one of the previous requests.
public hasPreviousSession ( ) : boolean
return boolean
    public function hasPreviousSession()
    {
        // the check for $this->session avoids malicious users trying to fake a session cookie with proper name
        return $this->hasSession() && $this->cookies->has($this->session->getName());
    }

Usage Example

Example #1
0
 /**
  * Get the flash notices
  *
  * @return array The flash notices, can be empty
  */
 public function getFlash()
 {
     if ($this->request->hasPreviousSession()) {
         return $this->request->getSession()->getFlashBag()->get('notice', []);
     }
     return [];
 }
All Usage Examples Of Symfony\Component\HttpFoundation\Request::hasPreviousSession