Neos\Flow\Session\TransientSession::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 data associated with the given key or NULL
    public function getData($key)
    {
        if ($this->started !== true) {
            throw new Exception\SessionNotStartedException('The session has not been started yet.', 1218034660);
        }
        return array_key_exists($key, $this->data) ? $this->data[$key] : null;
    }

Usage Example

 /**
  * @test
  */
 public function allSessionDataCanBeFlushedByCallingDestroy()
 {
     $session = new Session\TransientSession();
     $session->start();
     $session->putData('theKey', 'some data');
     $session->destroy();
     $session->start();
     $this->assertNull($session->getData('theKey'));
 }