@@ -92,8 +92,7 @@ |
||
92 | 92 | try |
93 | 93 | { |
94 | 94 | $this->range[$this->index]; |
95 | - } |
|
96 | - catch(\Exception $e) |
|
95 | + } catch(\Exception $e) |
|
97 | 96 | { |
98 | 97 | return false; |
99 | 98 | } |
@@ -93,8 +93,7 @@ |
||
93 | 93 | try |
94 | 94 | { |
95 | 95 | $this->subnet[$this->index]; |
96 | - } |
|
97 | - catch(\Exception $e) |
|
96 | + } catch(\Exception $e) |
|
98 | 97 | { |
99 | 98 | return false; |
100 | 99 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | foreach($address as $digit) |
114 | 114 | { |
115 | 115 | if (is_string($digit) ) |
116 | - { |
|
116 | + { |
|
117 | 117 | $digit = trim($digit); |
118 | 118 | if (strlen($digit)==0) |
119 | 119 | { |
@@ -271,23 +271,28 @@ discard block |
||
271 | 271 | { |
272 | 272 | $higherOctet = $this->address >> 24; |
273 | 273 | |
274 | - if (($higherOctet & 0x80) == 0) { |
|
274 | + if (($higherOctet & 0x80) == 0) |
|
275 | + { |
|
275 | 276 | return self::CLASS_A; |
276 | 277 | } |
277 | 278 | |
278 | - if (($higherOctet & 0xC0) == 0x80) { |
|
279 | + if (($higherOctet & 0xC0) == 0x80) |
|
280 | + { |
|
279 | 281 | return self::CLASS_B; |
280 | 282 | } |
281 | 283 | |
282 | - if (($higherOctet & 0xE0) == 0xC0) { |
|
284 | + if (($higherOctet & 0xE0) == 0xC0) |
|
285 | + { |
|
283 | 286 | return self::CLASS_C; |
284 | 287 | } |
285 | 288 | |
286 | - if (($higherOctet & 0xF0) == 0xE0) { |
|
289 | + if (($higherOctet & 0xF0) == 0xE0) |
|
290 | + { |
|
287 | 291 | return self::CLASS_D; |
288 | 292 | } |
289 | 293 | |
290 | - if (($higherOctet & 0xF0) == 0xF0) { |
|
294 | + if (($higherOctet & 0xF0) == 0xF0) |
|
295 | + { |
|
291 | 296 | return self::CLASS_E; |
292 | 297 | } |
293 | 298 | |
@@ -324,8 +329,7 @@ discard block |
||
324 | 329 | try |
325 | 330 | { |
326 | 331 | $this->asCidr(); |
327 | - } |
|
328 | - catch(DomainException $e) |
|
332 | + } catch(DomainException $e) |
|
329 | 333 | { |
330 | 334 | return false; |
331 | 335 | } |
@@ -353,8 +357,10 @@ discard block |
||
353 | 357 | Subnet::fromCidr(Address::fromString("172.16.0.0"), 12), |
354 | 358 | Subnet::fromCidr(Address::fromString("192.168.0.0"), 16), |
355 | 359 | ); |
356 | - foreach($subnets as $subnet) { |
|
357 | - if($subnet->contains($this)) { |
|
360 | + foreach($subnets as $subnet) |
|
361 | + { |
|
362 | + if($subnet->contains($this)) |
|
363 | + { |
|
358 | 364 | return true; |
359 | 365 | } |
360 | 366 | } |
@@ -405,7 +411,7 @@ discard block |
||
405 | 411 | * @return bool |
406 | 412 | */ |
407 | 413 | public function match(Address $address) |
408 | - { |
|
414 | + { |
|
409 | 415 | return $this->int() == $address->int(); |
410 | 416 | } |
411 | 417 |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | public function offsetExists($offset) |
150 | 150 | { |
151 | 151 | if (is_string($offset)) |
152 | - { |
|
152 | + { |
|
153 | 153 | if (!preg_match('/^-?[0-9]+$/', $offset)) |
154 | 154 | { |
155 | 155 | throw new InvalidArgumentException(sprintf('Invalid key type (%s), only integers or strings representing integers can be used to acces address in a Range', gettype($offset))); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $offset = (int)$offset; |
158 | 158 | } |
159 | 159 | if (!is_int($offset)) |
160 | - { |
|
160 | + { |
|
161 | 161 | throw new InvalidArgumentException(sprintf('Invalid key type (%s), only integers or strings representing integers can be used to acces address in a Range', gettype($offset))); |
162 | 162 | } |
163 | 163 | if ($offset<0 || $offset>=count($this)) |