base = $base; $this->get = $get; $this->post = $post; $this->headers = $headers; $this->session = $session; $userId = $this->session->get('userId'); if ($userId !== null) { $this->user = $userRepository->getById($userId); } } public function setParsedRouteParams(array $routeParams): void { $this->routeParams = $routeParams; } public function getBase(): string { return $this->base; } public function query($key) { if (isset($this->get[$key])) { return $this->get[$key]; } if (isset($this->routeParams[$key])) { return $this->routeParams[$key]; } return null; } public function post($key) { if (isset($this->post[$key])) { return $this->post[$key]; } return null; } public function header($key) { if (isset($this->headers[$key])) { return $this->headers[$key]; } return null; } public function session(): ISession { return $this->session; } public function setUser(?IUser $user): void { if ($user === null) { $this->session->delete('userId'); return; } $this->session->set('userId', $user->getUniqueId()); } public function user(): ?IUser { return $this->user; } }