PSR7Sessions\Storageless\Session\SessionInterface::isEmpty PHP Method

isEmpty() public method

Checks whether the session contains any data
public isEmpty ( ) : boolean
return boolean
    public function isEmpty() : bool;

Usage Example

 /**
  * @param SessionInterface $sessionContainer
  * @param Response         $response
  * @param Token            $token
  *
  * @return Response
  *
  * @throws \InvalidArgumentException
  */
 private function appendToken(SessionInterface $sessionContainer, Response $response, Token $token = null) : Response
 {
     $sessionContainerChanged = $sessionContainer->hasChanged();
     $sessionContainerEmpty = $sessionContainer->isEmpty();
     if ($sessionContainerChanged && $sessionContainerEmpty) {
         return FigResponseCookies::set($response, $this->getExpirationCookie());
     }
     if ($sessionContainerChanged || !$sessionContainerEmpty && $token && $this->shouldTokenBeRefreshed($token)) {
         return FigResponseCookies::set($response, $this->getTokenCookie($sessionContainer));
     }
     return $response;
 }