| @@ 184-192 (lines=9) @@ | ||
| 181 | /** |
|
| 182 | * @return string |
|
| 183 | */ |
|
| 184 | public static function ipAddress($ipAddress) |
|
| 185 | { |
|
| 186 | if (false === filter_var($ipAddress, FILTER_VALIDATE_IP)) { |
|
| 187 | throw new InputValidationException('invalid "ip_address"'); |
|
| 188 | } |
|
| 189 | ||
| 190 | // normalize the IP address (only makes a difference for IPv6) |
|
| 191 | return inet_ntop(inet_pton($ipAddress)); |
|
| 192 | } |
|
| 193 | ||
| 194 | /** |
|
| 195 | * @return string |
|
| @@ 221-229 (lines=9) @@ | ||
| 218 | /** |
|
| 219 | * @return string |
|
| 220 | */ |
|
| 221 | public static function ip6($ip6) |
|
| 222 | { |
|
| 223 | if (false === filter_var($ip6, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { |
|
| 224 | throw new InputValidationException('invalid "ip6"'); |
|
| 225 | } |
|
| 226 | ||
| 227 | // normalize the IPv6 address |
|
| 228 | return inet_ntop(inet_pton($ip6)); |
|
| 229 | } |
|
| 230 | ||
| 231 | /** |
|
| 232 | * @return int |
|