PHP Class Vectorface\Whip\IpRange\Ipv4Range

Author: Daniel Bruce ([email protected])
Inheritance: implements Vectorface\Whip\IpRange\IpRange
显示文件 Open project: vectorface/whip

Public Methods

Method Description
__construct ( string $range ) Constructor for the class.
containsIp ( string $ipAddress ) : boolean Returns whether or not a given IP address falls within this range.
getLowerInt ( ) : integer Returns the lower value of the IPv4 range as a long integer.
getUpperInt ( ) : integer Returns the upper value of the IPv4 range as a long integer.

Private Methods

Method Description
computeLowerAndUpperBounds ( string $range ) Computes the lower and upper bounds of the IPv4 range by parsing the range string.
parseCidrRange ( string $range ) : array Parses a CIDR notation range.
parseHyphenRange ( string $range ) : array Parses a hyphen notation range.
parseWildcardRange ( string $range, integer $pos ) : array Parses a wildcard notation range.

Method Details

__construct() public method

Constructor for the class.
public __construct ( string $range )
$range string A valid IPv4 range as a string. Supported range styles: - CIDR notation (127.0.0.1/24) - hyphen notation (127.0.0.1-127.0.0.255) - wildcard notation (127.0.0.*) - a single specific IP address (127.0.0.1)

containsIp() public method

Returns whether or not a given IP address falls within this range.
public containsIp ( string $ipAddress ) : boolean
$ipAddress string The given IP address.
return boolean Returns true if the IP address falls within the range and false otherwise.

getLowerInt() public method

Returns the lower value of the IPv4 range as a long integer.
public getLowerInt ( ) : integer
return integer The lower value of the IPv4 range.

getUpperInt() public method

Returns the upper value of the IPv4 range as a long integer.
public getUpperInt ( ) : integer
return integer The upper value of the IPv4 range.