DomainHostInterface
extends
Countable, HostInterface, IteratorAggregate
in
Tags
Table of Contents
Methods
- __toString() : string
- Returns the instance string representation.
- append() : self
- Appends a label to the host.
- count() : int
- Returns the labels total number.
- get() : string|null
- Retrieves a single host label.
- getIp() : string|null
- Returns the IP component If the Host is an IP address.
- getIpVersion() : string|null
- Returns the IP version.
- getIterator() : Iterator<string|int, string>
- Iterate over the Domain labels.
- getUriComponent() : string
- Returns the instance string representation with its optional URI delimiters.
- isAbsolute() : bool
- Tells whether the domain is absolute.
- isDomain() : bool
- Tells whether the host is a domain name.
- isIp() : bool
- Tells whether the host is an IP Address.
- isRegisteredName() : bool
- Tells whether the host is a registered name.
- jsonSerialize() : string|null
- Returns the instance json representation.
- keys() : array<string|int, int>
- Returns the associated key for a specific label or all the keys.
- prepend() : self
- Prepends a label to the host.
- slice() : self
- Extracts a slice of $length elements starting at position $offset from the host.
- toAscii() : string|null
- Returns the ascii representation.
- toString() : string
- Returns the instance string representation.
- toUnicode() : string|null
- Returns the unicode representation.
- value() : string|null
- Returns the instance string representation.
- withLabel() : self
- Returns an instance with the modified label.
- withoutLabel() : self
- Returns an instance without the specified label.
- withoutRootLabel() : self
- Returns an instance without its Root label.
- withRootLabel() : self
- Returns an instance with its Root label.
Methods
__toString()
Returns the instance string representation.
public
__toString() : string
If the instance is defined, the value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986, Sections 2 and 3.
If the instance is not defined, an empty string is returned
Return values
stringappend()
Appends a label to the host.
public
append(Stringable|string $label) : self
Parameters
- $label : Stringable|string
Return values
selfcount()
Returns the labels total number.
public
count() : int
Return values
intget()
Retrieves a single host label.
public
get(int $offset) : string|null
If the label offset has not been set, returns the null value.
Parameters
- $offset : int
Return values
string|nullgetIp()
Returns the IP component If the Host is an IP address.
public
getIp() : string|null
If the host is a not an IP this method will return null
Return values
string|nullgetIpVersion()
Returns the IP version.
public
getIpVersion() : string|null
If the host is a not an IP this method will return null
Return values
string|nullgetIterator()
Iterate over the Domain labels.
public
getIterator() : Iterator<string|int, string>
Return values
Iterator<string|int, string>getUriComponent()
Returns the instance string representation with its optional URI delimiters.
public
getUriComponent() : string
The value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986, Sections 2 and 3.
If the instance is not defined, an empty string is returned
Return values
stringisAbsolute()
Tells whether the domain is absolute.
public
isAbsolute() : bool
Return values
boolisDomain()
Tells whether the host is a domain name.
public
isDomain() : bool
Return values
boolisIp()
Tells whether the host is an IP Address.
public
isIp() : bool
Return values
boolisRegisteredName()
Tells whether the host is a registered name.
public
isRegisteredName() : bool
Return values
booljsonSerialize()
Returns the instance json representation.
public
jsonSerialize() : string|null
If the instance is defined, the value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986 or RFC 1738.
If the instance is not defined, null is returned
Return values
string|nullkeys()
Returns the associated key for a specific label or all the keys.
public
keys([string|null $label = null ]) : array<string|int, int>
Parameters
- $label : string|null = null
Return values
array<string|int, int>prepend()
Prepends a label to the host.
public
prepend(Stringable|string $label) : self
Parameters
- $label : Stringable|string
Return values
selfslice()
Extracts a slice of $length elements starting at position $offset from the host.
public
slice(int $offset[, int|null $length = null ]) : self
This method MUST retain the state of the current instance, and return an instance that contains the selected slice.
If $length is null it returns all elements from $offset to the end of the Domain.
Parameters
- $offset : int
- $length : int|null = null
Return values
selftoAscii()
Returns the ascii representation.
public
toAscii() : string|null
Return values
string|nulltoString()
Returns the instance string representation.
public
toString() : string
If the instance is defined, the value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986, Sections 2 and 3.
If the instance is not defined, an empty string is returned
Return values
stringtoUnicode()
Returns the unicode representation.
public
toUnicode() : string|null
Return values
string|nullvalue()
Returns the instance string representation.
public
value() : string|null
If the instance is defined, the value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986, Sections 2 and 3.
If the instance is not defined null is returned
Return values
string|nullwithLabel()
Returns an instance with the modified label.
public
withLabel(int $key, Stringable|string $label) : self
This method MUST retain the state of the current instance, and return an instance that contains the new label
If $key is non-negative, the added label will be the label at $key position from the start. If $key is negative, the added label will be the label at $key position from the end.
Parameters
- $key : int
- $label : Stringable|string
Tags
Return values
selfwithoutLabel()
Returns an instance without the specified label.
public
withoutLabel(int ...$keys) : self
This method MUST retain the state of the current instance, and return an instance that contains the modified component
If $key is non-negative, the removed label will be the label at $key position from the start. If $key is negative, the removed label will be the label at $key position from the end.
Parameters
- $keys : int
Tags
Return values
selfwithoutRootLabel()
Returns an instance without its Root label.
public
withoutRootLabel() : self
Tags
Return values
selfwithRootLabel()
Returns an instance with its Root label.
public
withRootLabel() : self