| @@ 56-58 (lines=3) @@ | ||
| 53 | $ipPrefix = 128; |
|
| 54 | } |
|
| 55 | ||
| 56 | if (!is_numeric($ipPrefix) || 0 > $ipPrefix || 128 < $ipPrefix) { |
|
| 57 | throw new IPException('IP prefix must be a number between 0 and 128'); |
|
| 58 | } |
|
| 59 | // normalize the IPv6 address |
|
| 60 | $ipAddress = inet_ntop(inet_pton($ipAddress)); |
|
| 61 | } else { |
|
| @@ 65-67 (lines=3) @@ | ||
| 62 | if (is_null($ipPrefix)) { |
|
| 63 | $ipPrefix = 32; |
|
| 64 | } |
|
| 65 | if (!is_numeric($ipPrefix) || 0 > $ipPrefix || 32 < $ipPrefix) { |
|
| 66 | throw new IPException('IP prefix must be a number between 0 and 32'); |
|
| 67 | } |
|
| 68 | } |
|
| 69 | ||
| 70 | $this->ipAddress = $ipAddress; |
|