IpAddressRange
in package
implements
JsonSerializable, Stringable, Equatable
FinalYes
Represents a CIDR range of IP addresses.
Table of Contents
Interfaces
- JsonSerializable
- Stringable
- Equatable
- 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.