Filter by country ISO 3166-1 code.

@param  string            $country
@return GenericCollection
483458
public function filterCountry($country = 'US')
    {
        return $this->filter(
            function ($key, $value) use ($country) {
                if ($value instanceof CountryFilter && $value->getIso31661() == $country) {
                    return true;
                }
            }
        );
    }
403805
public function setCountry(Country $country = null)
    {
        if ($this->country !== $country) {
            // romove link on this item for old country
            if ($this->country instanceof Country) {
                $tmp = $this->country;
                $this->country = null;
                $tmp->removeItem($this);
            }
            $this->country = $country;
            // add link on this item
            if ($this->country instanceof Country) {
                $this->country->addItem($this);
            }
        }

        return $this;
    }
394012
public function country(string $country): string
    {
        if (!Configure::read('countries')) {
            Configure::load('CkTools.countries');
        }
        $countries = Configure::read('countries');

        return $countries[$country] ?? $country;
    }
383586
public function getTopology($country)
    {
        return $this->helper->loadFile(
            $this->helper->dataDir('topo/'.strtolower($country).'.topo.json')
        );
    }
1311072
public function country($code){
		$geo = Geo::getCountry($code);
		$this->applyFilter($geo);
		return \Response::json($geo);
	}
1251080
public function getCountry()
    {
        if (! $this->country) {
            $this->country = $this->filterValidCountry($this->countries);
        }

        return $this->country;
    }
24205
public static function toIso($country)
    {
        $table = array_flip(self::isoCodes());

        if (!array_key_exists($country, $table)) {
            return null;
        }

        return $table[$country];
    }
459481
public function getGeometry($country)
    {
        return $this->helper->loadFile(
            $this->helper->dataDir('geo/'.strtolower($country).'.geo.json')
        );
    }
311554
public function getCodeFromCountry($country)
    {
        $output = 'OTH';
        if (array_key_exists($country, $this->countriesMapping)) {
            $output = $this->countriesMapping[$country];
        }

        return $output;
    }
864653
public static function countryLanguageCodes($countryCode)
    {
        $localeCodes = Locale::countryLocaleCodes($countryCode);

        $list = [];
        foreach ($localeCodes as $localeCode) {
            $list[] = Locale::languageCode($localeCode);
        }

        return $list;
    }
985503
public function getCountry($countryCode)
    {
        // accept lowercase country codes
        $countryCode = strtoupper($countryCode);

        $result = current(array_filter($this->countries, function ($country) use ($countryCode) {
            /** @var VATCountry $country */
            return ($country->getCode() == $countryCode || $country->getCountryCode() == $countryCode);
        }));

        return $result != false ? $result : null;
    }
955422
public static function countries($continent='all')
	{
		if (isset(self::$countries[$continent]))
		{
			return self::$countries[$continent];
		}

		$adapter  = new \Geocoder\HttpAdapter\CurlHttpAdapter();

		$p = array();

		// Get a list of providers
		//
		// Each provider has an associated plugin. If the provider supports
		// the desired data look-up, it (the provider) will be returned by
		// the plugin. Otherwise, the plugin returns nothing.
		if ($providers = \Event::trigger('geocode.onGeocodeProvider', array('geocode.countries', $adapter)))
		{
			foreach ($providers as $provider)
			{
				if ($provider)
				{
					$p[] = $provider;
				}
			}
		}

		if (!count($p))
		{
			return self::$countries;
		}

		// Instantiate the Geocoder service and pass it the list of providers
		$geocoder = new \Geocoder\Geocoder();
		$geocoder->registerProvider(new \Geocoder\Provider\ChainProvider($p));

		// Try to get some data...
		$geocoder->setResultFactory(new Result\CountriesResultFactory());

		$countries = array();

		if ($data = $geocoder->geocode($continent))
		{
			foreach ($data as $item)
			{
				$country = new \stdClass();
				$country->code      = $item->getCountryCode();
				$country->name      = $item->getCountry();
				$country->continent = $item->getRegion();

				$countries[] = $country;
			}
		}

		self::$countries[$continent] = $countries;

		return self::$countries[$continent];
	}
1208803
def queryDataCollectionByName(self, countryName):
        
        var = self._dataCollectionCodes
        try:
            return [x[0] for x in var[var['Countries'] == countryName]]
        except:
            return None
534232
public function matchCountry($country)
    {
        return $this->mode === self::MODE_POSITIVE && in_array($country, $this->countries)
            || $this->mode === self::MODE_NEGATIVE && !in_array($country, $this->countries);
    }
417598
private function getCountryByCode($code)
    {
        // Check if country exist in cache.
        if (array_key_exists($code, $this->countries)) {
            return $this->countries[$code];
        }
        // Fetch country.
        $country = $this->manager->getRepository(static::$countryEntityName)->findOneBy(['code' => $code]);
        if (!$country) {
            throw new \Doctrine\ORM\EntityNotFoundException('code = ' . $code);
        }
        // Add country to cache.
        $this->countries[$code] = $country;

        return $country;
    }
986215
public function hydrateFlag($country)
    {
        $country = countriesCollect($country)->overwrite(
            ['flag' => $this->repository->makeAllFlags($country)]
        );

        return $country;
    }
900758
public function addWhitelistCountry(string $country): self
    {
        $this->isValidCountry($country);

        $this->whitelistCountries[] = $country;

        return $this;
    }