/**
  * Returns the country as the numeric ISO 3166-1 code
  *
  * @throws Omnipay\Common\Exception\InvalidRequestException
  *
  * @return int ISO 3166-1 numeric country
  */
 protected function formatCountry()
 {
     $country = $this->getCard()->getCountry();
     if (!is_null($country) && !is_numeric($country)) {
         $iso3166 = new ISO3166();
         if (strlen($country) == 2) {
             $country = $iso3166->getByAlpha2($country)['numeric'];
         } elseif (strlen($country) == 3) {
             $country = $iso3166->getByAlpha3($country)['numeric'];
         } else {
             throw new InvalidRequestException("The country parameter must be ISO 3166-1 numeric, aplha2 or alpha3.");
         }
     }
     return $country;
 }