/** * Parse URI to determine controller, action and params part of the URI * * @return void */ protected function parseUri() { if (empty($_SERVER["REQUEST_URI"])) { return false; } // Get request URL without the forward slash "/" $path = trim(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH), "/"); // The URL consists of controller, action and an array of parameters @(list($this->url['controller'], $this->url['action'], $this->url['params']) = explode("/", $path, 3)); // Check if controller is present if (!empty($this->url['controller'])) { $this->setController($this->url['controller']); } // Check if action is present if (!empty($this->url['action'])) { $this->setAction($this->url['action']); } // Check if parameters are present if (!empty($this->url['params'])) { $this->request->setParams(explode("/", $this->url['params'])); } }