| @@ 48-50 (lines=3) @@ | ||
| 45 | $ipPrefix = 128; |
|
| 46 | } |
|
| 47 | ||
| 48 | if (!is_numeric($ipPrefix) || 0 > $ipPrefix || 128 < $ipPrefix) { |
|
| 49 | throw new IPException('IP prefix must be a number between 0 and 128'); |
|
| 50 | } |
|
| 51 | // normalize the IPv6 address |
|
| 52 | $ipAddress = inet_ntop(inet_pton($ipAddress)); |
|
| 53 | } else { |
|
| @@ 57-59 (lines=3) @@ | ||
| 54 | if (is_null($ipPrefix)) { |
|
| 55 | $ipPrefix = 32; |
|
| 56 | } |
|
| 57 | if (!is_numeric($ipPrefix) || 0 > $ipPrefix || 32 < $ipPrefix) { |
|
| 58 | throw new IPException('IP prefix must be a number between 0 and 32'); |
|
| 59 | } |
|
| 60 | } |
|
| 61 | ||
| 62 | $this->ipAddress = $ipAddress; |
|