Documentation

HostRecord
in package
implements JsonSerializable

FinalYes
Tags
phpstan-type

HostRecordSerializedShape array{0: array{host: ?string}, 1: array}}

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))*) ) ^(?:(?&reg_name)\.)*(?&reg_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
see
https://tools.ietf.org/html/rfc1034#section-3.5
see
https://tools.ietf.org/html/rfc1123#section-2.1
see
https://regex101.com/r/71j6rt/1

REGEXP_GEN_DELIMS

private mixed REGEXP_GEN_DELIMS = '/[:\/?#\[\]@ ]/'

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))*) ) ^(?:(?&reg_name)\.)*(?&reg_name)\.?$ /ix'
Tags
see
https://tools.ietf.org/html/rfc3986#section-3.2.2
see
https://regex101.com/r/fptU8V/1

Properties

$asciiIsLoaded

private bool $asciiIsLoaded = false

$hasZoneIdentifier

private bool|null $hasZoneIdentifier = null

$hostAsAscii

private string|null $hostAsAscii = null

$hostAsUnicode

private string|null $hostAsUnicode = 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
throws
Exception|SyntaxError

hasZoneIdentifier()

public hasZoneIdentifier() : bool
Return values
bool

ipValue()

public ipValue() : string|null
Return values
string|null

ipVersion()

public ipVersion() : string|null
Return values
string|null

isDomainType()

public isDomainType() : bool
Return values
bool

isRegisteredName()

public static isRegisteredName(Stringable|string|null $host) : bool
Parameters
$host : Stringable|string|null
Return values
bool

jsonSerialize()

public jsonSerialize() : string|null
Return values
string|null

toAscii()

public toAscii() : string|null
Return values
string|null

toUnicode()

public toUnicode() : string|null
Return values
string|null

        
On this page

Search results