HostRecord
in package
implements
JsonSerializable
FinalYes
Tags
Table of Contents
Interfaces
- JsonSerializable
Constants
- ADDRESS_BLOCK = "\xfe\x80"
- MAXIMUM_HOST_CACHED = 100
- Maximum number of host cached.
- REGEXP_DOMAIN_NAME = '/ (?(DEFINE) (?<let_dig> [a-z0-9]) # alpha digit (?<let_dig_hyp> [a-z0-9-]) # alpha digit and hyphen (?<ldh_str> (?&let_dig_hyp){0,61}(?&let_dig)) # domain label end (?<label> (?&let_dig)((?&ldh_str))?) # domain label (?<domain> (?&label)(\.(?&label)){0,126}\.?) # domain name ) ^(?&domain)$ /ix'
- Domain name regular expression.
- REGEXP_GEN_DELIMS = '/[:\/?#\[\]@ ]/'
- REGEXP_INVALID_HOST_CHARS = '/ [:\/?#\[\]@ ] # gen-delims characters as well as the space character /ix'
- REGEXP_IP_FUTURE = '/^ v(?<version>[A-F\d])+\. (?: (?<unreserved>[a-z\d_~\-\.])| (?<sub_delims>[!$&\'()*+,;=:]) # also include the : character )+ $/ix'
- REGEXP_NON_ASCII_PATTERN = '/[^\x20-\x7f]/'
- REGEXP_REGISTERED_NAME = '/ (?(DEFINE) (?<unreserved>[a-z0-9_~\-]) # . is missing as it is used to separate labels (?<sub_delims>[!$&\'()*+,;=]) (?<encoded>%[A-F0-9]{2}) (?<reg_name>(?:(?&unreserved)|(?&sub_delims)|(?&encoded))*) ) ^(?:(?®_name)\.)*(?®_name)\.?$ /ix'
- General registered name regular expression.
Properties
- $format : HostFormat
- $type : HostType
- $value : string|null
- $asciiIsLoaded : bool
- $hasZoneIdentifier : bool|null
- $hostAsAscii : string|null
- $hostAsUnicode : string|null
- $ipValue : string|null
- $ipVersion : string|null
- $isDomainName : bool|null
- $isIpValueLoaded : bool
- $isIpVersionLoaded : bool
- $unicodeIsLoaded : bool
Methods
- __serialize() : HostRecordSerializedShape
- __unserialize() : void
- from() : self
- hasZoneIdentifier() : bool
- ipValue() : string|null
- ipVersion() : string|null
- isDomain() : bool
- isDomainType() : bool
- isIp() : bool
- isIpv4() : bool
- isIpv6() : bool
- isIpvFuture() : bool
- isRegisteredName() : bool
- isValid() : bool
- jsonSerialize() : string|null
- toAscii() : string|null
- toUnicode() : string|null
- __construct() : mixed
- isValidDomain() : bool
- Tells whether the registered name is a valid domain name according to RFC1123.
- isValidIpv6Hostname() : bool
- Validates an Ipv6 as Host.
Constants
ADDRESS_BLOCK
private
mixed
ADDRESS_BLOCK
= "\xfe\x80"
MAXIMUM_HOST_CACHED
Maximum number of host cached.
private
int
MAXIMUM_HOST_CACHED
= 100
REGEXP_DOMAIN_NAME
Domain name regular expression.
private
mixed
REGEXP_DOMAIN_NAME
= '/
(?(DEFINE)
(?<let_dig> [a-z0-9]) # alpha digit
(?<let_dig_hyp> [a-z0-9-]) # alpha digit and hyphen
(?<ldh_str> (?&let_dig_hyp){0,61}(?&let_dig)) # domain label end
(?<label> (?&let_dig)((?&ldh_str))?) # domain label
(?<domain> (?&label)(\.(?&label)){0,126}\.?) # domain name
)
^(?&domain)$
/ix'
Everything but the domain name length is validated
Tags
REGEXP_GEN_DELIMS
private
mixed
REGEXP_GEN_DELIMS
= '/[:\/?#\[\]@ ]/'
REGEXP_INVALID_HOST_CHARS
private
mixed
REGEXP_INVALID_HOST_CHARS
= '/
[:\/?#\[\]@ ] # gen-delims characters as well as the space character
/ix'
Tags
REGEXP_IP_FUTURE
private
mixed
REGEXP_IP_FUTURE
= '/^
v(?<version>[A-F\d])+\.
(?:
(?<unreserved>[a-z\d_~\-\.])|
(?<sub_delims>[!$&\'()*+,;=:]) # also include the : character
)+
$/ix'
Tags
REGEXP_NON_ASCII_PATTERN
private
mixed
REGEXP_NON_ASCII_PATTERN
= '/[^\x20-\x7f]/'
REGEXP_REGISTERED_NAME
General registered name regular expression.
private
mixed
REGEXP_REGISTERED_NAME
= '/
(?(DEFINE)
(?<unreserved>[a-z0-9_~\-]) # . is missing as it is used to separate labels
(?<sub_delims>[!$&\'()*+,;=])
(?<encoded>%[A-F0-9]{2})
(?<reg_name>(?:(?&unreserved)|(?&sub_delims)|(?&encoded))*)
)
^(?:(?®_name)\.)*(?®_name)\.?$
/ix'
Tags
Properties
$format read-only
public
HostFormat
$format
$type read-only
public
HostType
$type
$value read-only
public
string|null
$value
$asciiIsLoaded
private
bool
$asciiIsLoaded
= false
$hasZoneIdentifier
private
bool|null
$hasZoneIdentifier
= null
$hostAsAscii
private
string|null
$hostAsAscii
= null
$hostAsUnicode
private
string|null
$hostAsUnicode
= null
$ipValue
private
string|null
$ipValue
= null
$ipVersion
private
string|null
$ipVersion
= null
$isDomainName
private
bool|null
$isDomainName
= null
$isIpValueLoaded
private
bool
$isIpValueLoaded
= false
$isIpVersionLoaded
private
bool
$isIpVersionLoaded
= false
$unicodeIsLoaded
private
bool
$unicodeIsLoaded
= false
Methods
__serialize()
public
__serialize() : HostRecordSerializedShape
Return values
HostRecordSerializedShape__unserialize()
public
__unserialize(HostRecordSerializedShape $data) : void
Parameters
- $data : HostRecordSerializedShape
Tags
from()
public
static from(Stringable|string|null $host) : self
Parameters
- $host : Stringable|string|null
Tags
Return values
selfhasZoneIdentifier()
public
hasZoneIdentifier() : bool
Return values
boolipValue()
public
ipValue() : string|null
Return values
string|nullipVersion()
public
ipVersion() : string|null
Return values
string|nullisDomain()
public
static isDomain(Stringable|string|null $host) : bool
Parameters
- $host : Stringable|string|null
Return values
boolisDomainType()
public
isDomainType() : bool
Return values
boolisIp()
public
static isIp(Stringable|string|null $host) : bool
Parameters
- $host : Stringable|string|null
Return values
boolisIpv4()
public
static isIpv4(Stringable|string|null $host) : bool
Parameters
- $host : Stringable|string|null
Return values
boolisIpv6()
public
static isIpv6(Stringable|string|null $host) : bool
Parameters
- $host : Stringable|string|null
Return values
boolisIpvFuture()
public
static isIpvFuture(Stringable|string|null $host) : bool
Parameters
- $host : Stringable|string|null
Return values
boolisRegisteredName()
public
static isRegisteredName(Stringable|string|null $host) : bool
Parameters
- $host : Stringable|string|null
Return values
boolisValid()
public
static isValid(Stringable|string|null $host) : bool
Parameters
- $host : Stringable|string|null
Return values
booljsonSerialize()
public
jsonSerialize() : string|null
Return values
string|nulltoAscii()
public
toAscii() : string|null
Return values
string|nulltoUnicode()
public
toUnicode() : string|null
Return values
string|null__construct()
private
__construct(string|null $value, HostType $type, HostFormat $format) : mixed
Parameters
- $value : string|null
- $type : HostType
- $format : HostFormat
isValidDomain()
Tells whether the registered name is a valid domain name according to RFC1123.
private
static isValidDomain(string $hostname) : bool
Parameters
- $hostname : string
Tags
Return values
boolisValidIpv6Hostname()
Validates an Ipv6 as Host.
private
static isValidIpv6Hostname(string $host) : bool
Parameters
- $host : string