Neos\Flow\Session\Session::hasKey PHP Method

hasKey() public method

Returns TRUE if a session data entry $key is available.
public hasKey ( string $key ) : boolean
$key string Entry identifier of the session data
return boolean
    public function hasKey($key)
    {
        if ($this->started !== true) {
            throw new Exception\SessionNotStartedException('Tried to check a session data entry, but the session has not been started yet.', 1352488661);
        }
        return $this->storageCache->has($this->storageIdentifier . md5($key));
    }

Usage Example

 /**
  * @test
  * @expectedException \Neos\Flow\Session\Exception\SessionNotStartedException
  */
 public function hasKeyThrowsExceptionIfCalledOnNonStartedSession()
 {
     $session = new Session();
     $session->hasKey('foo');
 }