session instanceof SessionEntity) { return $this->session; } $sessionStorage = $this->server->getSessionStorage(); if (!$sessionStorage instanceof SessionStorage) { throw new ErrorException('SessionStorage must be instance of ' . SessionStorage::class); } return $sessionStorage->getById($this->sessionId); } public function getSessionId() : int { return $this->sessionId; } public function setSession(OriginalSessionEntity $session) { parent::setSession($session); $this->setSessionId($session->getId()); return $this; } public function setSessionId(int $sessionId) { $this->sessionId = $sessionId; } }