PHP Class Webiny\Component\StdLib\StdObject\UrlObject\UrlObject

If you want to extract parameters from a url, or to build/change its parts, this is a class for that.
Inheritance: extends Webiny\Component\StdLib\StdObject\AbstractStdObject, use trait Webiny\Component\StdLib\ValidatorTrait, use trait ManipulatorTrait, use trait Webiny\Component\StdLib\StdObjectTrait
ファイルを表示 Open project: Webiny/Framework Class Usage Examples

Protected Properties

Property Type Description
$value

Public Methods

Method Description
__construct ( string $value ) Constructor.
__toString ( ) : string To string implementation.
buildUrl ( ArrayObject | array $parts ) : UrlObject Build a UrlObject from array parts.
getDomain ( ) : string | boolean Get the domain name of the current url.
getHost ( ) : boolean | string Get host name, without trailing slash.
getPath ( boolean $asStringObject = false ) : string | StringObject Get the path from the current url.
getPort ( ) : boolean | integer Get port number.
getQuery ( ) : array Get query params as an array from current object.
getScheme ( ) : boolean | string Get scheme (eg. http).
val ( null | string $url = null ) : mixed Return, or update, current standard objects value.

Private Methods

Method Description
getHeaderResponseString ( integer $headerCode ) : string Get a string for the given header response code.
rebuildUrl ( ) Builds url from current url elements.
validateUrl ( ) Validates current url and parses data like scheme, host, query, and similar from, it.

Method Details

__construct() public method

Set standard object value.
public __construct ( string $value )
$value string

__toString() public method

To string implementation.
public __toString ( ) : string
return string

buildUrl() static public method

Build a UrlObject from array parts.
static public buildUrl ( ArrayObject | array $parts ) : UrlObject
$parts Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject | array Url parts, possible keys are: 'scheme', 'host', 'port', 'path' and 'query'
return UrlObject

getDomain() public method

Get the domain name of the current url.
public getDomain ( ) : string | boolean
return string | boolean Domain name, or false it's not set.

getHost() public method

Get host name, without trailing slash.
public getHost ( ) : boolean | string
return boolean | string Host name without the trailing slash.

getPath() public method

Get the path from the current url.
public getPath ( boolean $asStringObject = false ) : string | StringObject
$asStringObject boolean Return instance of StringObject
return string | Webiny\Component\StdLib\StdObject\StringObject\StringObject Path from the current instance.

getPort() public method

Get port number.
public getPort ( ) : boolean | integer
return boolean | integer Port number, or false if it's not set.

getQuery() public method

Get query params as an array from current object.
public getQuery ( ) : array
return array Array containing query params from the current instance.

getScheme() public method

Get scheme (eg. http).
public getScheme ( ) : boolean | string
return boolean | string Url scheme, or false if it's not set.

val() public method

Return, or update, current standard objects value.
public val ( null | string $url = null ) : mixed
$url null | string
return mixed

Property Details

$value protected_oe property

protected $value