Neos\Flow\Session\Session::getData PHP Method

getData() public method

Returns the data associated with the given key.
public getData ( string $key ) : mixed
$key string An identifier for the content stored in the session.
return mixed The contents associated with the given key
    public function getData($key)
    {
        if ($this->started !== true) {
            throw new Exception\SessionNotStartedException('Tried to get session data, but the session has not been started yet.', 1351162255);
        }
        return $this->storageCache->get($this->storageIdentifier . md5($key));
    }

Usage Example

 /**
  * @test
  * @expectedException \Neos\Flow\Session\Exception\SessionNotStartedException
  */
 public function getDataThrowsExceptionIfSessionIsNotStarted()
 {
     $session = new Session();
     $session->getData('some key');
 }