/** * @return string */ public static function pathInfo() { if (!static::$pathInfo) { static::$pathInfo = static::preparePathInfo(); } return static::$pathInfo; }
/** * Sets up the request. */ public static function init() { static::$query = new ParameterBag($_GET); static::$post = new ParameterBag($_POST); static::$properties = new ParameterBag(); static::$server = new ParameterBag($_SERVER); static::$headers = static::buildHeaderBag(); static::$method = isset($_POST['_method']) ? $_POST['_method'] : $_SERVER['REQUEST_METHOD']; static::$requestUri = $_SERVER['REQUEST_URI']; static::$scriptName = $_SERVER['SCRIPT_NAME']; static::$basePath = rtrim(str_replace(basename(static::$scriptName), '', static::$scriptName), '/'); static::$pathInfo = str_replace(static::$scriptName, '', static::$requestUri); static::$pathInfo = static::preparePathInfo(); static::$segments = explode('/', trim(static::$pathInfo, '/')); }
public function __construct() { static::$instance = $this; static::$request = $_REQUEST; static::$get = $_GET; static::$post = $_POST; static::$server = $_SERVER; static::$headers = static::getAllHeaders(); static::$requestUri = static::prepareRequestUri(); static::$baseUrl = static::prepareBaseUrl(); static::$basePath = static::prepareBasePath(); static::$pathInfo = static::preparePathInfo(); static::$method = static::$server['REQUEST_METHOD']; }
public static function pathInfo() { if (!is_null(static::$pathInfo)) { return static::$pathInfo; } $pathInfo = array_get(static::$server, "PATH_INFO", "/"); if (empty($pathInfo) || $pathInfo == "/") { $pathInfo = array_get(static::$server, "ORIG_PATH_INFO", "/"); if (strpos($pathInfo, "/index.php") === 0) { $pathInfo = str_replace("/index.php", "", $pathInfo); } } if (empty($pathInfo)) { $pathInfo = "/"; } static::$pathInfo = $pathInfo; return $pathInfo; }