@param string $country

@throws \Kerox\Messenger\Exception\MessengerException

@return \Kerox\Messenger\Model\ProfileSettings\TargetAudience
181425
public function addBlacklistCountry(string $country): self
    {
        $this->isValidCountry($country);

        $this->blacklistCountries[] = $country;

        return $this;
    }
997562
static function setUserCountry( $user, $country )
    {
        $userObject = $user->attribute( 'contentobject' );
        $requireUserCountry = eZVATManager::isUserCountryRequired();
        $countryAttributeName = eZVATManager::getUserCountryAttributeName( $requireUserCountry );
        if ( $countryAttributeName === null )
        {
            return false;
        }

        $userDataMap = $userObject->attribute( 'data_map' );
        if ( !isset( $userDataMap[$countryAttributeName] ) )
        {
            if ( $requireUserCountry )
            {
                eZDebug::writeError( "Cannot set user country: there is no attribute '$countryAttributeName' in object '" .
                                       $userObject->attribute( 'name' ) .
                                       "' of class '" .
                                       $userObject->attribute( 'class_name' ) . "'.",
                                     __METHOD__ );
            }

            return false;
        }

        eZDebug::writeNotice( sprintf( "Saving country '%s' for user '%s'",
                                       $country, $user->attribute( 'login' ) ) );

        $countryAttribute = $userDataMap[$countryAttributeName];
        $countryAttributeContent = $countryAttribute->content();
        if ( is_array( $countryAttributeContent ) )
            $countryAttributeContent['value'] = $country;
        elseif ( is_object( $countryAttributeContent ) )
            $countryAttributeContent->setAttribute( 'value', $country );
        // not sure that this line is needed since content is returned by reference
        $countryAttribute->setContent( $countryAttributeContent );
        $countryAttribute->store();

        return true;
    }
145911
public function getAreaForCountry(Country $country)
    {
        $area = null;

        if (null !== $areaDeliveryModule = AreaDeliveryModuleQuery::create()->findByCountryAndModule(
            $country,
            $this->getModuleModel()
        )) {
            $area = $areaDeliveryModule->getArea();
        }

        return $area;
    }
437380
public function refreshCountry(Country $country)
    {

        $refreshedCountry = $this->findCountryBy(array('id' => $country->getId()));
        if (null === $refreshedCountry) {
            throw new UsernameNotFoundException(sprintf('User with ID "%d" could not be reloaded.', $country->getId()));
        }
        return $refreshedCountry;
    }
1295030
public function fetchLocation($address, $country = null) {
        $params = array(
            'address' => urlencode($address),
            'sensor' => 'false'
        );

        if ($country) {
            $params['components'] = 'country:' . $country;
        }

        $url = self::API_URL . http_build_query($params);
        $rawResponse = file_get_contents($url);
        $response = new Garp_Service_Google_Maps_Response($rawResponse);

        return $response;
    }
467964
public function findByCountryAndModule(Country $country, Module $module, State $state = null)
    {
        $response = null;

        $countryInAreaList = CountryAreaQuery::findByCountryAndState($country, $state);

        /** @var CountryArea $countryInArea */
        foreach ($countryInAreaList as $countryInArea) {
            $response = self::create()->filterByAreaId($countryInArea->getAreaId())
                ->filterByModule($module)
                ->findOne()
            ;

            if ($response !== null) {
                break;
            }
        }

        return $response;
    }
1291232
public function getCompanyVatInValidator($country)
    {
        if (is_null($this->_oCompanyVatInValidator)) {
            /** @var \OxidEsales\Eshop\Core\CompanyVatInValidator $vatInValidator */
            $vatInValidator = oxNew('oxCompanyVatInValidator', $country);

            /** @var \OxidEsales\Eshop\Core\CompanyVatInCountryChecker $validator */
            $validator = oxNew(\OxidEsales\Eshop\Core\CompanyVatInCountryChecker::class);

            $vatInValidator->addChecker($validator);

            /** @var \OxidEsales\Eshop\Core\OnlineVatIdCheck $onlineValidator */
            if (!\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam("blVatIdCheckDisabled")) {
                $onlineValidator = oxNew(\OxidEsales\Eshop\Core\OnlineVatIdCheck::class);
                $vatInValidator->addChecker($onlineValidator);
            }

            $this->setCompanyVatInValidator($vatInValidator);
        }

        return $this->_oCompanyVatInValidator;
    }
161613
public function get(array $profileSettings): ProfileResponse
    {
        $this->isValidFields($profileSettings);

        $profileSettings = implode(',', $profileSettings);

        $request = new ProfileRequest($this->pageToken, $profileSettings);
        $response = $this->client->get('me/messenger_profile', $request->build());

        return new ProfileResponse($response);
    }
1235753
public function update(Country &$country)
    {
        $data = $country->exportData();
        $endpoint = '/admin/countries/'.$country->id.'.json';
        $response = $this->request(
            $endpoint, 'PUT', array(
            'country' => $data
            )
        );
        $country->setData($response['country']);
    }
519760
public function setCountry(Country $v = null)
    {
        if ($v === null) {
            $this->setCountryId(NULL);
        } else {
            $this->setCountryId($v->getId());
        }

        $this->aCountry = $v;

        // Add binding for other direction of this n:n relationship.
        // If this object has already been added to the Country object, it will not be re-added.
        if ($v !== null) {
            $v->addCustomer($this);
        }


        return $this;
    }
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;
    }
483458
public function filterCountry($country = 'US')
    {
        return $this->filter(
            function ($key, $value) use ($country) {
                if ($value instanceof CountryFilter && $value->getIso31661() == $country) {
                    return true;
                }
            }
        );
    }
1099049
public function setCountry(\Core\Entity\Country $country = null)
    {
        $this->country = $country;

        return $this;
    }
838283
private function loadCities($country)
    {
        return $this->repository->getHelper()->loadJson($country['cca3'], 'cities/default')
                ->overwrite($this->repository->getHelper()->loadJson($country['cca3'], 'cities/overload'));
    }
686850
protected function getCountry($countryId)
    {
        $entityManager = $this->getEntityManager();

        /** @var \Rcm\Repository\Country $countryRepo */
        $countryRepo = $entityManager->getRepository(\Rcm\Entity\Country::class);

        $country = $countryRepo->find(
            $countryId
        );

        if (!$country instanceof Country) {
            throw new \Exception("Country {$countryId} could not be found.");
        }

        return $country;
    }
878136
public function setCountry($country)
    {
        $country = strtoupper($country);
        if (!Icepay_Parameter_Validation::country($country))
            throw new Exception('Country not valid');
        $this->data->ic_country = $country;
        return $this;
    }
220350
public function populateCountry($countryCode)
    {
        $rootLocation = $this
            ->locationPopulatorAdapter
            ->populate($countryCode);

        $this
            ->locationObjectManager
            ->persist($rootLocation);

        $this
            ->locationObjectManager
            ->flush($rootLocation);

        return $this;
    }