IPAddressRange
in package
implements
JsonSerializable, Stringable, IEquatable
FinalYes
Represents a CIDR range of IP addresses.
Table of Contents
Interfaces
- JsonSerializable
- Stringable
- IEquatable
- Provides an interface for determining the value-equality of two objects.
Methods
- __construct() : mixed
- __serialize() : array<string|int, mixed>
- __toString() : string
- __unserialize() : void
- equals() : bool
- Checks whether the current object is equal to another.
- getBaseAddress() : IPAddress
- Retrieves the base IP address.
- getCIDR() : string
- Retrieves full CIDR representation of this range.
- getMask() : int
- Retrieves the CIDR mask.
- jsonSerialize() : mixed
- match() : bool
- Checks if a given IP address matches with this range.
- parse() : IPAddressRange
- Attempts to parse a string into an IP address range.
Methods
__construct()
public
__construct(IPAddress $base, int $mask) : mixed
Parameters
- $base : IPAddress
-
Base IP address.
- $mask : int
-
CIDR mask.
__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__toString()
public
__toString() : string
Return values
string__unserialize()
public
__unserialize(array{b: string, m: int} $serialized) : void
Parameters
- $serialized : array{b: string, m: int}
equals()
Checks whether the current object is equal to another.
public
equals(mixed $other) : bool
Parameters
- $other : mixed
Return values
bool —true if the objects are equals, false if not.
getBaseAddress()
Retrieves the base IP address.
public
getBaseAddress() : IPAddress
Return values
IPAddress —Base IP address.
getCIDR()
Retrieves full CIDR representation of this range.
public
getCIDR() : string
Return values
string —CIDR string.
getMask()
Retrieves the CIDR mask.
public
getMask() : int
Return values
int —CIDR mask.
jsonSerialize()
public
jsonSerialize() : mixed
match()
Checks if a given IP address matches with this range.
public
match(IPAddress $address) : bool
Parameters
- $address : IPAddress
-
IP address to check.
Return values
bool —true if the address matches.
parse()
Attempts to parse a string into an IP address range.
public
static parse(string $string) : IPAddressRange
Parameters
- $string : string
-
String to parse.
Tags
Return values
IPAddressRange —Representation of the given string.