Пример #1
0
 /**
  * Sets the country, use either a two letter representation or the integer constant.
  *
  * @param  int  $country {@link KlarnaCountry}
  * @throws KlarnaException
  * @return void
  */
 public function setCountry($country) {
     if(!is_numeric($country) && strlen($country) == 2) {
         $this->setCountry(Klarna::getCountryForCode($country));
     }
     else {
         if(!isset($country)) {
             throw new KlarnaException("Error in " . __METHOD__ . ": Country is not set!");
         }
         if(is_numeric($country) && !is_int($country)) {
             $country = intval($country);
         }
         if(!is_numeric($country) || !is_int($country)) {
             throw new KlarnaException("Error in " . __METHOD__ . ": Country not an integer! ($country)");
         }
         $this->country = $country;
     }
 }