Index Documentation

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

__serialize()

public __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__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.

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.

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
throws
InvalidArgumentException

If $string does not contain a valid CIDR range string.

Return values
IpAddressRange

Representation of the given string.


        
On this page

Search results