vB_Ip
in package
Uses
vB_Trait_NoSerialize
Table of Contents
Constants
- IPV4_REGEX = '(\\d{1,3})(?:\\.(\\d{1,3})){3}'
Methods
- __serialize() : array<string|int, mixed>
- __sleep() : array<string|int, mixed>
- __unserialize() : void
- __wakeup() : void
- areIpsEqual() : bool
- Determines if the IPS are the same. Note that this should work ccross different formats
- getIpFields() : mixed
- Gets ip fields for storage from a string representation of IP. If the IP string is invalid it returns false.
- ipInArray() : bool
- Determines if the ip is one of the IPs are the same based on the rules for areIpsEqual
- isValidIPv4() : bool
- Validates an IPv4 address
- validateIPv6() : mixed
- Validates an IPv6 string representation and returns the ip fields for storage. If representation is invalid it returns false.
Constants
IPV4_REGEX
public
mixed
IPV4_REGEX
= '(\\d{1,3})(?:\\.(\\d{1,3})){3}'
Methods
__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__sleep()
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>__unserialize()
public
__unserialize(array<string|int, mixed> $serialized) : void
Parameters
- $serialized : array<string|int, mixed>
__wakeup()
public
__wakeup() : void
areIpsEqual()
Determines if the IPS are the same. Note that this should work ccross different formats
public
static areIpsEqual(string $ip1, string $ip2) : bool
Note that if either ip address string is invalid the function will always return false.
Assumes the ip values are both strings
Parameters
- $ip1 : string
- $ip2 : string
Return values
boolgetIpFields()
Gets ip fields for storage from a string representation of IP. If the IP string is invalid it returns false.
public
static getIpFields(string $ipAddress) : mixed
Parameters
- $ipAddress : string
ipInArray()
Determines if the ip is one of the IPs are the same based on the rules for areIpsEqual
public
static ipInArray(mixed $ip, array<string|int, mixed> $iparray) : bool
Assumes the ip values are all strings
Parameters
- $ip : mixed
- $iparray : array<string|int, mixed>
Return values
boolisValidIPv4()
Validates an IPv4 address
public
static isValidIPv4(string $ipAddress) : bool
Parameters
- $ipAddress : string
Return values
boolvalidateIPv6()
Validates an IPv6 string representation and returns the ip fields for storage. If representation is invalid it returns false.
public
static validateIPv6(string $ipAddress) : mixed
Parameters
- $ipAddress : string