Methods |
public
|
__construct(string $ip)
IPAddress constructor.
|
#
|
public
static
|
fromRequest(): IPAddress
Get IP address from the request server data
Get IP address from the request server data
|
#
|
protected
|
normalize(string $ip): string|false
convert IP address into a normalized condensed notation
convert IP address into a normalized condensed notation
Parameters
$ip |
ip address to normalize
|
Returns
normalized address or false on failure
|
#
|
public
|
asReadable(): string|false
return presentation form of address
return presentation form of address
|
#
|
public
|
asBinary(): string|false
get network (binary) form of address
get network (binary) form of address
|
#
|
public
|
ipVersion(): int|false
get the ip version, 4 or 6, of address
get the ip version, 4 or 6, of address
Returns
integer 4 for IPV4, 6 for IPV6, or false if invalid
|
#
|
public
|
sameSubnet(string $matchIp, int $netMask4, int $netMask6): bool
Is this IP in the same subnet as the supplied address?
Is this IP in the same subnet as the supplied address?
Accepts net masks for both IPV4 and IPV6 and will select the appropriate one, to
allow checking policy against request input with minimal method calls.
Parameters
$matchIp |
presentation form ip address to compare
|
$netMask4 |
network mask, bits to match <= 32 for IPV4
|
$netMask6 |
network mask, bits to match <=128 for IPV6
|
Returns
true if $this->ip and $matchIp are both in the specified subnet
|
#
|
protected
|
asBinaryString(IPAddress $ip): string
Convert an IP address to a binary character string (i.e. "01111111000000000000000000000001")
Convert an IP address to a binary character string (i.e. "01111111000000000000000000000001")
Parameters
|
#
|