public static function fromBytes(array $bytes)
    {
        $result = null;
        if (count($bytes) === 16) {
            $address = '';
            for ($i = 0; $i < 16; ++$i) {
                if ($i !== 0 && $i % 2 === 0) {
                    $address .= ':';
                }
                $byte = $bytes[$i];
                if (is_int($byte) && $byte >= 0 && $byte <= 255) {
                    $address .= sprintf('%02x', $byte);
                } else {
                    $address = null;
                    break;
                }
            }
            if ($address !== null) {
                $result = new static($address);
            }
        }

        return $result;
    }
public static function fromBytes(array $bytes)
    {
        $result = null;
        if (count($bytes) === 16) {
            $address = '';
            for ($i = 0; $i < 16; ++$i) {
                if ($i !== 0 && $i % 2 === 0) {
                    $address .= ':';
                }
                $byte = $bytes[$i];
                if (is_int($byte) && $byte >= 0 && $byte <= 255) {
                    $address .= sprintf('%02x', $byte);
                } else {
                    $address = null;
                    break;
                }
            }
            if ($address !== null) {
                $result = new static($address);
            }
        }

        return $result;
    }
public static function fromBytes ( array $ bytes ) { $ result = null ; if ( count ( $ bytes ) === 16 ) { $ address = '' ; for ( $ i = 0 ; $ i < 16 ; ++ $ i ) { if ( $ i !== 0 && $ i % 2 === 0 ) { $ address .= ':' ; } $ byte = $ bytes [ $ i ] ; if ( is_int ( $ byte ) && $ byte >= 0 && $ byte <= 255 ) { $ address .= sprintf ( '%02x' , $ byte ) ; } else { $ address = null ; break ; } } if ( $ address !== null ) { $ result = new static ( $ address ) ; } } return $ result ; }
Parse an array of bytes and returns an IPv6 instance if the array is valid, or null otherwise.

@param int[]|array $bytes

@return static|null
Parse an array of bytes and returns an IPv6 instance if the array is valid or null otherwise .