public static function getByRawAddress(array $addr)
 {
     if (count($addr) == Inet4Address::INADDRSZ) {
         return new Inet4Address($addr);
     } else {
         if (count($addr) == Inet6Address::INADDRSZ) {
             $newAddr = Inet6Address::convertFromIPv4MappedAddress($addr);
             if ($newAddr != null) {
                 return new Inet4Address($newAddr);
             } else {
                 return new Inet6Address($addr);
             }
         }
     }
     throw new UnknownHostException('addr is of illegal length');
 }
 public function createSubnet_creates_subnet_with_trailing_zeros()
 {
     $addr = new Inet6Address('febc:a574:382b:23c1:aa49:4592:4efe:9982');
     $subNetSize = 64;
     $expAddr = new Inet6Address('febc:a574:382b:23c1::');
     $this->assertEquals($expAddr->asString(), $addr->createSubnet($subNetSize)->getAddress()->asString());
     $subNetSize = 48;
     $expAddr = new Inet6Address('febc:a574:382b::');
     $this->assertEquals($expAddr->asString(), $addr->createSubnet($subNetSize)->getAddress()->asString());
     $subNetSize = 35;
     $expAddr = new Inet6Address('febc:a574:2000::');
     $this->assertEquals($expAddr->asString(), $addr->createSubnet($subNetSize)->getAddress()->asString());
     $subNetSize = 128;
     $expAddr = $addr;
     $this->assertEquals($expAddr->asString(), $addr->createSubnet($subNetSize)->getAddress()->asString());
 }