Piwik\Plugins\UserCountry\LocationProvider::getIpFromInfo PHP Method

getIpFromInfo() protected method

Returns an IP address from an array that was passed into getLocation. This will return an IPv4 address or IPv6 address.
protected getIpFromInfo ( array $info ) : string | null
$info array Must have 'ip' key.
return string | null
    protected function getIpFromInfo($info)
    {
        $ip = \Piwik\Network\IP::fromStringIP($info['ip']);
        if ($ip instanceof \Piwik\Network\IPv6 && $ip->isMappedIPv4()) {
            return $ip->toIPv4String();
        } else {
            return $ip->toString();
        }
    }