Imbo\EventListener\StatsAccess::expandIPv6 PHP Method

expandIPv6() private method

Expand a short IPv6
private expandIPv6 ( string $ip ) : string
$ip string For instance 2a00:1b60:1011::1338
return string 2a00:1b60:1011:0000:0000:0000:0000:1338
    private function expandIPv6($ip)
    {
        // Convert to in_addr an unpack as hex
        $hex = strtolower(bin2hex(inet_pton($ip)));
        // Inject colons
        return substr(preg_replace('/([a-f0-9]{4})/', '$1:', $hex), 0, -1);
    }