Piwik\Plugins\UserCountry\LocationProvider\DefaultProvider::getLocation PHP Метод

getLocation() публичный Метод

Guesses a visitor's location using a visitor's browser language.
public getLocation ( array $info ) : array
$info array Contains 'ip' & 'lang' keys.
Результат array Contains the guessed country code mapped to LocationProvider::COUNTRY_CODE_KEY.
    public function getLocation($info)
    {
        $enableLanguageToCountryGuess = Config::getInstance()->Tracker['enable_language_to_country_guess'];
        if (empty($info['lang'])) {
            $info['lang'] = Common::getBrowserLanguage();
        }
        $country = Common::getCountry($info['lang'], $enableLanguageToCountryGuess, $info['ip']);
        $location = array(parent::COUNTRY_CODE_KEY => $country);
        $this->completeLocationResult($location);
        return $location;
    }