Gets the Session.
SessionNotFoundException When session is not set properly
public function getSession() : SessionInterface { $session = $this->session; if (!$session instanceof SessionInterface && null !== $session) { $this->setSession($session = $session()); } if (null === $session) { throw new SessionNotFoundException('Session has not been set.'); } return $session; }