<?php

namespace ModulesGarden\HostingQuotaNotifications\App\Helper;

use ModulesGarden\HostingQuotaNotifications\Core\ModuleConstants;
/**
 * Description of CountriesHelper
 *
 * @author Artur Pilch <artur.pi@modulesgarden.com>
 */
class CountriesHelper
{


    public static function getCountries()
    {
        $path = ModuleConstants::getFullPathWhmcs() . '/resources/country/dist.countries.json';

        if (file_exists($path))
        {
            $countries = file_get_contents($path);
            return json_decode($countries);
        }

        return array();
    }

    public static function getFullCountryName($country_code)
    {
        $countries = static::getCountries();

        if (isset($countries->$country_code))
            return $countries->$country_code->name;
        return $country_code;
    }


    
    
}
