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

setCurrentProvider() публичный статический Метод

Sets the provider to use when tracking.
public static setCurrentProvider ( string $providerId ) : LocationProvider
$providerId string The ID of the provider to use.
Результат LocationProvider The new current provider.
    public static function setCurrentProvider($providerId)
    {
        $provider = self::getProviderById($providerId);
        if (empty($provider)) {
            throw new Exception("Invalid provider ID '{$providerId}'. The provider either does not exist or is not available");
        }
        Option::set(self::CURRENT_PROVIDER_OPTION_NAME, $providerId);
        Cache::clearCacheGeneral();
        return $provider;
    }

Usage Example

 public function setUp()
 {
     $this->setUpWebsitesAndGoals();
     self::downloadGeoIpDbs();
     LocationProvider::$providers = null;
     GeoIp::$geoIPDatabaseDir = 'tests/lib/geoip-files';
     LocationProvider::setCurrentProvider('geoip_php');
     $this->trackVisits();
     $this->setupSegments();
 }
All Usage Examples Of Piwik\Plugins\UserCountry\LocationProvider::setCurrentProvider