@@ 41-49 (lines=9) @@ | ||
38 | /** |
|
39 | * @param string $ip |
|
40 | */ |
|
41 | public function __construct($ip) |
|
42 | { |
|
43 | if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false) { |
|
44 | throw InvalidPointTypeException::point('IPv4', $ip); |
|
45 | } |
|
46 | ||
47 | $this->ip = $ip; |
|
48 | $this->long = ip2long($ip); |
|
49 | } |
|
50 | ||
51 | /** |
|
52 | * @return int |
@@ 70-78 (lines=9) @@ | ||
67 | /** |
|
68 | * @param string $ip |
|
69 | */ |
|
70 | public function __construct($ip) |
|
71 | { |
|
72 | if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) { |
|
73 | throw InvalidPointTypeException::point('IPv6', $ip); |
|
74 | } |
|
75 | ||
76 | $this->ip = $ip; |
|
77 | $this->long = inet_pton($ip); |
|
78 | } |
|
79 | ||
80 | /** |
|
81 | * @return int |