private function IpAddress::inRange6 in IP address fields 8
Same name and namespace in other branches
- 2.0.x src/IpAddress.php \Drupal\field_ipaddress\IpAddress::inRange6()
Checks if the current IPv6 is within a given min and max IP.
1 call to IpAddress::inRange6()
- IpAddress::inRange in src/
IpAddress.php - Checks if the stored IP is within $min and $max IPs.
File
- src/
IpAddress.php, line 296
Class
- IpAddress
- IpTools class.
Namespace
Drupal\field_ipaddressCode
private function inRange6($min, $max) {
$min_bin = inet_pton($min);
$max_bin = inet_pton($max);
if ($this->type == self::IP_RANGE_NONE) {
$start_bin = $end_bin = inet_pton($this->start);
}
else {
$start_bin = inet_pton($this->start);
$end_bin = inet_pton($this->end);
}
return $start_bin >= $min_bin && $start_bin <= $max_bin && ($end_bin >= $min_bin && $end_bin <= $max_bin);
}