@@ 104-114 (lines=11) @@ | ||
101 | * |
|
102 | * @return self |
|
103 | */ |
|
104 | public static function fromString($string) |
|
105 | { |
|
106 | if (!preg_match(self::REGEXP, $string, $match)) { |
|
107 | throw InvalidIntervalFormatException::create('0.0.0.0/32', $string); |
|
108 | } |
|
109 | ||
110 | // fill IP compact format |
|
111 | $match['ip'] .= str_repeat('.0', 3 - substr_count($match['ip'], '.')); |
|
112 | ||
113 | return self::fromCIDR($match['ip'], $match['cidr']); |
|
114 | } |
|
115 | ||
116 | /** |
|
117 | * Checks if this network is equal to the specified network. |
@@ 116-124 (lines=9) @@ | ||
113 | * |
|
114 | * @return self |
|
115 | */ |
|
116 | public static function fromString($string) |
|
117 | { |
|
118 | if (!preg_match(self::REGEXP, $string, $match)) { |
|
119 | $ipv6 = implode(':', array_fill(0, 8, 'ffff')); |
|
120 | ||
121 | throw InvalidIntervalFormatException::create($ipv6.'/128', $string); |
|
122 | } |
|
123 | ||
124 | return self::fromCIDR($match['ip'], $match['cidr']); |
|
125 | } |
|
126 | ||
127 | /** |