![]() |
Pfw_XH
|
CMSimple_XH internal URLs as value objects. More...
Public Member Functions | |
__toString () | |
Convenience wrapper for getRelative(). More... | |
getRelative () | |
Return the "relative" URL string. More... | |
getAbsolute () | |
Return the fully qualified absoulte URL string. More... | |
with ($param, $value) | |
Add or replace a query string parameter. More... | |
without ($param) | |
Remove a query string parameter. More... | |
Static Public Member Functions | |
static | getCurrent () |
Return the URL of the current request. More... | |
CMSimple_XH internal URLs as value objects.
Url
value objects are most useful to manipulate certain query string parameters of the requested URL, but can also be used to construct other URLs of the CMSimple_XH installation. At least for CMSimple_XH internal URLs they should be preferred over manual URL construction which is error prone and too concrete (consider clean URLs). Furthermore, the Url
objects let you focus on removing and adding query string parameters as needed, instead of simply ignoring parameters of other plugins.
Typical usage example:
$url = Url::getCurrent() // get current URL ->without('foo') // remove the `foo` parameter ->with('bar', 'baz'); // add a `bar` parameter with value `baz` $urlString = (string) $url;
Pfw\Url::__toString | ( | ) |
Convenience wrapper for getRelative().
Pfw\Url::getAbsolute | ( | ) |
Return the fully qualified absoulte URL string.
|
static |
Return the URL of the current request.
Pfw\Url::getRelative | ( | ) |
Return the "relative" URL string.
Actually, this method returns an absolute URL string, which is not fully qualified, though; it consists of path and query string only.
Pfw\Url::with | ( | $param, | |
$value | |||
) |
Add or replace a query string parameter.
If the $param
query string parameter already exists, it is replaced with the new $value
(which may be a string or an array). Otherwise the query parameter is added to the URL.
string | $param | |
mixed | $value |
Pfw\Url::without | ( | $param | ) |
Remove a query string parameter.
The $param
query string parameter is removed if it exists. Otherwise the method silently succeeds.
string | $param |