public function make() { $request = new Request(); $request->setMethod($_SERVER['REQUEST_METHOD']); $request->setHost($_SERVER['HTTP_HOST']); $request->setPath(substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?') ?: strlen($_SERVER['REQUEST_URI']))); $request->setGet($_GET); $request->setPost($_POST); return $request; }
/** * */ protected static function parsePath() { $direction = array(); if ($url = parse_url(Request::server('REQUEST_URI'))) { if (isset($url['path'])) { $relpath = dirname(Request::server('SCRIPT_NAME')); $path = trim(str_replace($relpath != '/' ? $relpath : '', '', Request::server('REQUEST_URI')), '/'); if (!empty($path)) { Request::setPath(explode('/', $path)); } } //make sure that module name is capitalized $module = ucfirst(Request::getPath(0)); if (file_exists(\APPLICATION_BASE . '/' . $module)) { $direction[0] = $module; $direction[1] = Request::getPath(1); } } return $direction; }