@@ -20,15 +20,15 @@ |
||
| 20 | 20 | $mask = null; |
| 21 | 21 | $words = unpack('n*', $octets) ?: []; |
| 22 | 22 | switch (count($words)) { |
| 23 | - case 8: |
|
| 24 | - $ip = self::_wordsToIPv6String($words); |
|
| 25 | - break; |
|
| 26 | - case 16: |
|
| 27 | - $ip = self::_wordsToIPv6String(array_slice($words, 0, 8)); |
|
| 28 | - $mask = self::_wordsToIPv6String(array_slice($words, 8, 8)); |
|
| 29 | - break; |
|
| 30 | - default: |
|
| 31 | - throw new \UnexpectedValueException('Invalid IPv6 octet length.'); |
|
| 23 | + case 8: |
|
| 24 | + $ip = self::_wordsToIPv6String($words); |
|
| 25 | + break; |
|
| 26 | + case 16: |
|
| 27 | + $ip = self::_wordsToIPv6String(array_slice($words, 0, 8)); |
|
| 28 | + $mask = self::_wordsToIPv6String(array_slice($words, 8, 8)); |
|
| 29 | + break; |
|
| 30 | + default: |
|
| 31 | + throw new \UnexpectedValueException('Invalid IPv6 octet length.'); |
|
| 32 | 32 | } |
| 33 | 33 | return new self($ip, $mask); |
| 34 | 34 | } |
@@ -20,15 +20,15 @@ |
||
| 20 | 20 | $mask = null; |
| 21 | 21 | $bytes = unpack('C*', $octets) ?: []; |
| 22 | 22 | switch (count($bytes)) { |
| 23 | - case 4: |
|
| 24 | - $ip = implode('.', $bytes); |
|
| 25 | - break; |
|
| 26 | - case 8: |
|
| 27 | - $ip = implode('.', array_slice($bytes, 0, 4)); |
|
| 28 | - $mask = implode('.', array_slice($bytes, 4, 4)); |
|
| 29 | - break; |
|
| 30 | - default: |
|
| 31 | - throw new \UnexpectedValueException('Invalid IPv4 octet length.'); |
|
| 23 | + case 4: |
|
| 24 | + $ip = implode('.', $bytes); |
|
| 25 | + break; |
|
| 26 | + case 8: |
|
| 27 | + $ip = implode('.', array_slice($bytes, 0, 4)); |
|
| 28 | + $mask = implode('.', array_slice($bytes, 4, 4)); |
|
| 29 | + break; |
|
| 30 | + default: |
|
| 31 | + throw new \UnexpectedValueException('Invalid IPv4 octet length.'); |
|
| 32 | 32 | } |
| 33 | 33 | return new self($ip, $mask); |
| 34 | 34 | } |