ApaiIO\Configuration\GenericConfiguration::setCountry PHP Method

setCountry() public method

Sets and validates the country
public setCountry ( string $country ) : GenericConfiguration
$country string
return GenericConfiguration
    public function setCountry($country)
    {
        if (!Country::isValidCountry($country)) {
            throw new \InvalidArgumentException(sprintf("Invalid Country-Code: %s! Possible Country-Codes: %s", $country, implode(', ', Country::getCountries())));
        }
        $this->country = strtolower($country);
        return $this;
    }

Usage Example

Ejemplo n.º 1
0
 protected function setUp()
 {
     if (isset($this->conf) && isset($this->apaiIO)) {
         return $this;
     }
     $this->conf = new GenericConfiguration();
     $this->conf->setCountry($this->amazonConf['country'])->setAccessKey($this->amazonConf['amazon_ws_api_key'])->setSecretKey($this->amazonConf['amazon_ws_api_secret_key'])->setAssociateTag($this->amazonConf['amazon_ws_api_associate_tag']);
     $this->apaiIO = new ApaiIO($this->conf);
     return $this;
 }
All Usage Examples Of ApaiIO\Configuration\GenericConfiguration::setCountry