PHPFusion\Geomap::get_Country PHP Метод

get_Country() статический публичный Метод

Returns countries
static public get_Country ( null $country_code = NULL ) : array | null
$country_code null - ISO cca2 code / returns array if NULL
Результат array | null
    static function get_Country($country_code = NULL)
    {
        if (empty(self::$country_list)) {
            $resource = json_decode(file_get_contents(CLASSES . "PHPFusion/Geomap/Countries.json"));
            foreach ($resource as $object) {
                $country_name = $object->name->common;
                self::$country_list[$object->cca2] = $country_name;
            }
        }
        if ($country_code !== NULL) {
            return isset(self::$country_list[$country_code]) ? self::$country_list[$country_code] : NULL;
        } else {
            return array_filter(self::$country_list);
        }
    }