class UrlConfig implements ConfigProvider

Properties

protected SchemeList $allowedSchemes
protected HostnameList $disallowedHosts
protected HostnameList $restrictedHosts

Methods

__construct()

Constructor

array|Dictionary|null
asConfig()

Return an array-based representation of this object to be used for parsing

void
allowScheme(string $scheme)

Allow a URL scheme

void
disallowHost(string $host, bool $matchSubdomains = true)

Disallow a hostname (or hostname mask) from being used in URLs

void
disallowScheme(string $scheme)

Remove a scheme from the list of allowed URL schemes

array
getAllowedSchemes()

Return the list of allowed URL schemes

void
restrictHost(string $host, bool $matchSubdomains = true)

Allow a hostname (or hostname mask) to being used in URLs while disallowing everything else

Details

at line 35
__construct()

Constructor

at line 48
array|Dictionary|null asConfig()

Return an array-based representation of this object to be used for parsing

NOTE: if this method was named getConfig() it could interfere with magic getters from the Configurable trait

Return Value

array|Dictionary|null

at line 59
void allowScheme(string $scheme)

Allow a URL scheme

Parameters

string $scheme

URL scheme, e.g. "file" or "ed2k"

Return Value

void

at line 76
void disallowHost(string $host, bool $matchSubdomains = true)

Disallow a hostname (or hostname mask) from being used in URLs

Parameters

string $host

Hostname or hostmask

bool $matchSubdomains

Whether to match subdomains of given host

Return Value

void

at line 92
void disallowScheme(string $scheme)

Remove a scheme from the list of allowed URL schemes

Parameters

string $scheme

URL scheme, e.g. "file" or "ed2k"

Return Value

void

at line 102
array getAllowedSchemes()

Return the list of allowed URL schemes

Return Value

array

at line 116
void restrictHost(string $host, bool $matchSubdomains = true)

Allow a hostname (or hostname mask) to being used in URLs while disallowing everything else

Can be called multiple times to restricts URLs to a set of given hostnames

Parameters

string $host

Hostname or hostmask

bool $matchSubdomains

Whether to match subdomains of given host

Return Value

void