SiteURIFactory
in package
FinalYes
Creates SiteURI using superglobals.
This class also updates superglobal $_SERVER and $_GET.
Tags
Table of Contents
Properties
- $appConfig : App
- $superglobals : Superglobals
Methods
- __construct() : mixed
- createFromGlobals() : SiteURI
- Create the current URI object from superglobals.
- createURIFromRoutePath() : SiteURI
- Create current URI object.
- getHost() : string|null
- getValidHost() : string|null
- parseQueryString() : string
- Will parse QUERY_STRING and automatically detect the URI from it.
- parseRequestURI() : string
- Will parse the REQUEST_URI and automatically detect the URI from it, fixing the query string if necessary.
Properties
$appConfig read-only
private
App
$appConfig
$superglobals read-only
private
Superglobals
$superglobals
Methods
__construct()
public
__construct(App $appConfig, Superglobals $superglobals) : mixed
Parameters
- $appConfig : App
- $superglobals : Superglobals
createFromGlobals()
Create the current URI object from superglobals.
public
createFromGlobals() : SiteURI
This method updates superglobal $_SERVER and $_GET.
Return values
SiteURIcreateURIFromRoutePath()
Create current URI object.
private
createURIFromRoutePath(string $routePath) : SiteURI
Parameters
- $routePath : string
-
URI path relative to baseURL
Return values
SiteURIgetHost()
private
getHost() : string|null
Return values
string|null —The current hostname. Returns null if no valid host.
getValidHost()
private
getValidHost(string $host) : string|null
Parameters
- $host : string
Return values
string|null —The valid hostname. Returns null if not valid.
parseQueryString()
Will parse QUERY_STRING and automatically detect the URI from it.
private
parseQueryString() : string
This method updates superglobal $_SERVER and $_GET.
Return values
string —The route path (before normalization).
parseRequestURI()
Will parse the REQUEST_URI and automatically detect the URI from it, fixing the query string if necessary.
private
parseRequestURI() : string
This method updates superglobal $_SERVER and $_GET.
Return values
string —The route path (before normalization).