@@ 448-451 (lines=4) @@ | ||
445 | */ |
|
446 | public function toIPv4() |
|
447 | { |
|
448 | if (strpos($this->longAddress, '2002:') === 0) { |
|
449 | // 6to4 |
|
450 | return IPv4::fromBytes(array_slice($this->getBytes(), 2, 4)); |
|
451 | } |
|
452 | if (strpos($this->longAddress, '0000:0000:0000:0000:0000:ffff:') === 0) { |
|
453 | // IPv4-mapped IPv6 addresses |
|
454 | return IPv4::fromBytes(array_slice($this->getBytes(), -4)); |
|
@@ 452-455 (lines=4) @@ | ||
449 | // 6to4 |
|
450 | return IPv4::fromBytes(array_slice($this->getBytes(), 2, 4)); |
|
451 | } |
|
452 | if (strpos($this->longAddress, '0000:0000:0000:0000:0000:ffff:') === 0) { |
|
453 | // IPv4-mapped IPv6 addresses |
|
454 | return IPv4::fromBytes(array_slice($this->getBytes(), -4)); |
|
455 | } |
|
456 | ||
457 | return null; |
|
458 | } |