_view = new View(); } // final public function getView(): View { return $this->_view; } final public function __get($name) { return $this->getView()->$name; } final public function __set($name, $value) { $this->getView()->$name = $value; } final public function setSegments(array $segments) { $this->_segments = $segments; } final public function getSegments(string $key = ""): mixed { if ($key === "") { return $this->_segments; } return array_key_exists($key, $this->_segments) ? $this->_segments[$key] : null; } final public function getRequest(mixed $key = null, mixed $method = null): mixed { if ($this->_request === null) { $this->_request = match (strtoupper($method)) { "POST" => $_POST, "GET" => $_GET, default => $_REQUEST, }; } if ($key === null) { return $this->_request; } return array_key_exists($key, $this->_request) ? $this->_request[$key] : null; } final public function getPost(mixed $key = null): mixed { return $this->getRequest($key, "POST"); } final public function getGet(mixed $key = null): mixed { return $this->getRequest($key, "GET"); } public function render(string $path) { return $this->getView()->render($path); } } //Class