IpAddress
Table of Contents
Methods
- __construct() : mixed
- __toString() : string
- Returns address's value.
- createByName() : static
- Creates the object by a host name.
- createByUri() : static
- Creates the object by a Uri.
- get() : string
- Returns address's value.
- isIPv4() : bool
- Retuns true if the address is IPv4.
- isPrivate() : bool
- Retuns true if the address is incorrect or private.
- matchRange() : bool
- Check IPv4 address is within an IP range
- toRange() : string
- Formats IP as a range (192.168.0.0/24).
- toUnsigned() : string
- Formats IP as an unsigned int and returns it as a sting.
Methods
__construct()
public
__construct(string $ip) : mixed
Parameters
- $ip : string
__toString()
Returns address's value.
public
__toString() : string
Return values
stringcreateByName()
Creates the object by a host name.
public
static createByName(string $name) : static
Parameters
- $name : string
Return values
staticcreateByUri()
Creates the object by a Uri.
public
static createByUri(UriInterface $uri) : static
Parameters
- $uri : UriInterface
Return values
staticget()
Returns address's value.
public
get() : string
Return values
stringisIPv4()
Retuns true if the address is IPv4.
public
isIPv4() : bool
Return values
boolisPrivate()
Retuns true if the address is incorrect or private.
public
isPrivate() : bool
Return values
boolmatchRange()
Check IPv4 address is within an IP range
public
matchRange(string $cidr) : bool
Parameters
- $cidr : string
-
a valid IPv4 subnet[/mask]
Return values
booltoRange()
Formats IP as a range (192.168.0.0/24).
public
toRange(int $prefixLen) : string
Parameters
- $prefixLen : int
Return values
stringtoUnsigned()
Formats IP as an unsigned int and returns it as a sting.
public
toUnsigned() : string