lib/AktiveMerchant/Common/Country.php
public static function find($name)
    {
        if (empty($name)) {
            throw new \InvalidArgumentException('Cannot lookup country for an empty name');
        }

        if (strlen($name) == 2 || strlen($name) == 3) {
            $upcase_name = strtoupper($name);
            $country_code = new CountryCode($name);
            $country_format = $country_code->getFormat();
            foreach (self::$COUNTRIES as $c) {
                if ($c[$country_format] == $upcase_name) {
                    $country = $c;
                    break;
                }
            }
        } else {
            foreach (self::$COUNTRIES as $c) {
                if ($c['name'] == $name) {
                    $country = $c;
                    break;
                }
            }
        }
        if (!isset($country)) {
            throw new \OutOfRangeException("No country could be found for name {$name}");
        }

        return new Country($country);
    }
public static function find($name)
    {
        if (empty($name)) {
            throw new \InvalidArgumentException('Cannot lookup country for an empty name');
        }

        if (strlen($name) == 2 || strlen($name) == 3) {
            $upcase_name = strtoupper($name);
            $country_code = new CountryCode($name);
            $country_format = $country_code->getFormat();
            foreach (self::$COUNTRIES as $c) {
                if ($c[$country_format] == $upcase_name) {
                    $country = $c;
                    break;
                }
            }
        } else {
            foreach (self::$COUNTRIES as $c) {
                if ($c['name'] == $name) {
                    $country = $c;
                    break;
                }
            }
        }
        if (!isset($country)) {
            throw new \OutOfRangeException("No country could be found for name {$name}");
        }

        return new Country($country);
    }
public static function find ( $ name ) { if ( empty ( $ name ) ) { throw new \ InvalidArgumentException ( 'Cannot lookup country for an empty name' ) ; } if ( strlen ( $ name ) == 2 || strlen ( $ name ) == 3 ) { $ upcase_name = strtoupper ( $ name ) ; $ country_code = new CountryCode ( $ name ) ; $ country_format = $ country_code -> getFormat ( ) ; foreach ( self :: $ COUNTRIES as $ c ) { if ( $ c [ $ country_format ] == $ upcase_name ) { $ country = $ c ; break ; } } } else { foreach ( self :: $ COUNTRIES as $ c ) { if ( $ c [ 'name' ] == $ name ) { $ country = $ c ; break ; } } } if ( ! isset ( $ country ) ) { throw new \ OutOfRangeException ( "No country could be found for name {$name}" ) ; } return new Country ( $ country ) ; }
Returns a Country object based on a given alpha or numeric code.

<code>
$country = Country::find(300);
$country = Country::find('GR');
$country = Country::find('GRC');
</code>

@param string|integer Alpha name or numeric code of a country

@return Country A Country object.
Returns a Country object based on a given alpha or numeric code .