<?php
namespace SabaiApps\Directories\Component\System\Helper;

use SabaiApps\Directories\Application;

/**
 * CountriesHelper provides country names and phone codes.
 */
class CountriesHelper {

	/**
	 * Returns an array of country codes and names, or the name for a specific code.
	 *
	 * @param Application $application
	 * @param string|null $code
	 * @return array|string|null
	 */
	public function help( Application $application, $code = null ) {
		$ret = array(
			'AF' => __( 'Afghanistan', 'directories-pro' ),
			'AX' => __( 'Aland Islands', 'directories-pro' ),
			'AL' => __( 'Albania', 'directories-pro' ),
			'DZ' => __( 'Algeria', 'directories-pro' ),
			'AS' => __( 'American Samoa', 'directories-pro' ),
			'AD' => __( 'Andorra', 'directories-pro' ),
			'AO' => __( 'Angola', 'directories-pro' ),
			'AI' => __( 'Anguilla', 'directories-pro' ),
			'AQ' => __( 'Antarctica', 'directories-pro' ),
			'AG' => __( 'Antigua And Barbuda', 'directories-pro' ),
			'AR' => __( 'Argentina', 'directories-pro' ),
			'AM' => __( 'Armenia', 'directories-pro' ),
			'AW' => __( 'Aruba', 'directories-pro' ),
			'AU' => __( 'Australia', 'directories-pro' ),
			'AT' => __( 'Austria', 'directories-pro' ),
			'AZ' => __( 'Azerbaijan', 'directories-pro' ),
			'BS' => __( 'Bahamas', 'directories-pro' ),
			'BH' => __( 'Bahrain', 'directories-pro' ),
			'BD' => __( 'Bangladesh', 'directories-pro' ),
			'BB' => __( 'Barbados', 'directories-pro' ),
			'BY' => __( 'Belarus', 'directories-pro' ),
			'BE' => __( 'Belgium', 'directories-pro' ),
			'BZ' => __( 'Belize', 'directories-pro' ),
			'BJ' => __( 'Benin', 'directories-pro' ),
			'BM' => __( 'Bermuda', 'directories-pro' ),
			'BT' => __( 'Bhutan', 'directories-pro' ),
			'BO' => __( 'Bolivia', 'directories-pro' ),
			'BA' => __( 'Bosnia And Herzegovina', 'directories-pro' ),
			'BW' => __( 'Botswana', 'directories-pro' ),
			'BV' => __( 'Bouvet Island', 'directories-pro' ),
			'BR' => __( 'Brazil', 'directories-pro' ),
			'IO' => __( 'British Indian Ocean Territory', 'directories-pro' ),
			'BN' => __( 'Brunei Darussalam', 'directories-pro' ),
			'BG' => __( 'Bulgaria', 'directories-pro' ),
			'BF' => __( 'Burkina Faso', 'directories-pro' ),
			'BI' => __( 'Burundi', 'directories-pro' ),
			'KH' => __( 'Cambodia', 'directories-pro' ),
			'CM' => __( 'Cameroon', 'directories-pro' ),
			'CA' => __( 'Canada', 'directories-pro' ),
			'CV' => __( 'Cape Verde', 'directories-pro' ),
			'KY' => __( 'Cayman Islands', 'directories-pro' ),
			'CF' => __( 'Central African Republic', 'directories-pro' ),
			'TD' => __( 'Chad', 'directories-pro' ),
			'CL' => __( 'Chile', 'directories-pro' ),
			'CN' => __( 'China', 'directories-pro' ),
			'CX' => __( 'Christmas Island', 'directories-pro' ),
			'CC' => __( 'Cocos (Keeling) Islands', 'directories-pro' ),
			'CO' => __( 'Colombia', 'directories-pro' ),
			'KM' => __( 'Comoros', 'directories-pro' ),
			'CG' => __( 'Congo', 'directories-pro' ),
			'CD' => __( 'Congo, Democratic Republic', 'directories-pro' ),
			'CK' => __( 'Cook Islands', 'directories-pro' ),
			'CR' => __( 'Costa Rica', 'directories-pro' ),
			'CI' => __( "Cote D'Ivoire", 'directories-pro' ),
			'HR' => __( 'Croatia', 'directories-pro' ),
			'CU' => __( 'Cuba', 'directories-pro' ),
			'CY' => __( 'Cyprus', 'directories-pro' ),
			'CZ' => __( 'Czech Republic', 'directories-pro' ),
			'DK' => __( 'Denmark', 'directories-pro' ),
			'DJ' => __( 'Djibouti', 'directories-pro' ),
			'DM' => __( 'Dominica', 'directories-pro' ),
			'DO' => __( 'Dominican Republic', 'directories-pro' ),
			'EC' => __( 'Ecuador', 'directories-pro' ),
			'EG' => __( 'Egypt', 'directories-pro' ),
			'SV' => __( 'El Salvador', 'directories-pro' ),
			'GQ' => __( 'Equatorial Guinea', 'directories-pro' ),
			'ER' => __( 'Eritrea', 'directories-pro' ),
			'EE' => __( 'Estonia', 'directories-pro' ),
			'ET' => __( 'Ethiopia', 'directories-pro' ),
			'FK' => __( 'Falkland Islands (Malvinas)', 'directories-pro' ),
			'FO' => __( 'Faroe Islands', 'directories-pro' ),
			'FJ' => __( 'Fiji', 'directories-pro' ),
			'FI' => __( 'Finland', 'directories-pro' ),
			'FR' => __( 'France', 'directories-pro' ),
			'GF' => __( 'French Guiana', 'directories-pro' ),
			'PF' => __( 'French Polynesia', 'directories-pro' ),
			'TF' => __( 'French Southern Territories', 'directories-pro' ),
			'GA' => __( 'Gabon', 'directories-pro' ),
			'GM' => __( 'Gambia', 'directories-pro' ),
			'GE' => __( 'Georgia', 'directories-pro' ),
			'DE' => __( 'Germany', 'directories-pro' ),
			'GH' => __( 'Ghana', 'directories-pro' ),
			'GI' => __( 'Gibraltar', 'directories-pro' ),
			'GR' => __( 'Greece', 'directories-pro' ),
			'GL' => __( 'Greenland', 'directories-pro' ),
			'GD' => __( 'Grenada', 'directories-pro' ),
			'GP' => __( 'Guadeloupe', 'directories-pro' ),
			'GU' => __( 'Guam', 'directories-pro' ),
			'GT' => __( 'Guatemala', 'directories-pro' ),
			'GG' => __( 'Guernsey', 'directories-pro' ),
			'GN' => __( 'Guinea', 'directories-pro' ),
			'GW' => __( 'Guinea-Bissau', 'directories-pro' ),
			'GY' => __( 'Guyana', 'directories-pro' ),
			'HT' => __( 'Haiti', 'directories-pro' ),
			'HM' => __( 'Heard Island & Mcdonald Islands', 'directories-pro' ),
			'VA' => __( 'Holy See (Vatican City State)', 'directories-pro' ),
			'HN' => __( 'Honduras', 'directories-pro' ),
			'HK' => __( 'Hong Kong', 'directories-pro' ),
			'HU' => __( 'Hungary', 'directories-pro' ),
			'IS' => __( 'Iceland', 'directories-pro' ),
			'IN' => __( 'India', 'directories-pro' ),
			'ID' => __( 'Indonesia', 'directories-pro' ),
			'IR' => __( 'Iran', 'directories-pro' ),
			'IQ' => __( 'Iraq', 'directories-pro' ),
			'IE' => __( 'Ireland', 'directories-pro' ),
			'IM' => __( 'Isle Of Man', 'directories-pro' ),
			'IL' => __( 'Israel', 'directories-pro' ),
			'IT' => __( 'Italy', 'directories-pro' ),
			'JM' => __( 'Jamaica', 'directories-pro' ),
			'JP' => __( 'Japan', 'directories-pro' ),
			'JE' => __( 'Jersey', 'directories-pro' ),
			'JO' => __( 'Jordan', 'directories-pro' ),
			'KZ' => __( 'Kazakhstan', 'directories-pro' ),
			'KE' => __( 'Kenya', 'directories-pro' ),
			'KI' => __( 'Kiribati', 'directories-pro' ),
			'KR' => __( 'Korea', 'directories-pro' ),
			'KW' => __( 'Kuwait', 'directories-pro' ),
			'KG' => __( 'Kyrgyzstan', 'directories-pro' ),
			'LA' => __( "Lao People's Democratic Republic", 'directories-pro' ),
			'LV' => __( 'Latvia', 'directories-pro' ),
			'LB' => __( 'Lebanon', 'directories-pro' ),
			'LS' => __( 'Lesotho', 'directories-pro' ),
			'LR' => __( 'Liberia', 'directories-pro' ),
			'LY' => __( 'Libyan Arab Jamahiriya', 'directories-pro' ),
			'LI' => __( 'Liechtenstein', 'directories-pro' ),
			'LT' => __( 'Lithuania', 'directories-pro' ),
			'LU' => __( 'Luxembourg', 'directories-pro' ),
			'MO' => __( 'Macao', 'directories-pro' ),
			'MK' => __( 'Macedonia', 'directories-pro' ),
			'MG' => __( 'Madagascar', 'directories-pro' ),
			'MW' => __( 'Malawi', 'directories-pro' ),
			'MY' => __( 'Malaysia', 'directories-pro' ),
			'MV' => __( 'Maldives', 'directories-pro' ),
			'ML' => __( 'Mali', 'directories-pro' ),
			'MT' => __( 'Malta', 'directories-pro' ),
			'MH' => __( 'Marshall Islands', 'directories-pro' ),
			'MQ' => __( 'Martinique', 'directories-pro' ),
			'MR' => __( 'Mauritania', 'directories-pro' ),
			'MU' => __( 'Mauritius', 'directories-pro' ),
			'YT' => __( 'Mayotte', 'directories-pro' ),
			'MX' => __( 'Mexico', 'directories-pro' ),
			'FM' => __( 'Federated States of Micronesia', 'directories-pro' ),
			'MD' => __( 'Moldova', 'directories-pro' ),
			'MC' => __( 'Monaco', 'directories-pro' ),
			'MN' => __( 'Mongolia', 'directories-pro' ),
			'ME' => __( 'Montenegro', 'directories-pro' ),
			'MS' => __( 'Montserrat', 'directories-pro' ),
			'MA' => __( 'Morocco', 'directories-pro' ),
			'MZ' => __( 'Mozambique', 'directories-pro' ),
			'MM' => __( 'Myanmar', 'directories-pro' ),
			'NA' => __( 'Namibia', 'directories-pro' ),
			'NR' => __( 'Nauru', 'directories-pro' ),
			'NP' => __( 'Nepal', 'directories-pro' ),
			'NL' => __( 'Netherlands', 'directories-pro' ),
			'AN' => __( 'Netherlands Antilles', 'directories-pro' ),
			'NC' => __( 'New Caledonia', 'directories-pro' ),
			'NZ' => __( 'New Zealand', 'directories-pro' ),
			'NI' => __( 'Nicaragua', 'directories-pro' ),
			'NE' => __( 'Niger', 'directories-pro' ),
			'NG' => __( 'Nigeria', 'directories-pro' ),
			'NU' => __( 'Niue', 'directories-pro' ),
			'NF' => __( 'Norfolk Island', 'directories-pro' ),
			'MP' => __( 'Northern Mariana Islands', 'directories-pro' ),
			'NO' => __( 'Norway', 'directories-pro' ),
			'OM' => __( 'Oman', 'directories-pro' ),
			'PK' => __( 'Pakistan', 'directories-pro' ),
			'PW' => __( 'Palau', 'directories-pro' ),
			'PS' => __( 'Palestinian Territories', 'directories-pro' ),
			'PA' => __( 'Panama', 'directories-pro' ),
			'PG' => __( 'Papua New Guinea', 'directories-pro' ),
			'PY' => __( 'Paraguay', 'directories-pro' ),
			'PE' => __( 'Peru', 'directories-pro' ),
			'PH' => __( 'Philippines', 'directories-pro' ),
			'PN' => __( 'Pitcairn', 'directories-pro' ),
			'PL' => __( 'Poland', 'directories-pro' ),
			'PT' => __( 'Portugal', 'directories-pro' ),
			'PR' => __( 'Puerto Rico', 'directories-pro' ),
			'QA' => __( 'Qatar', 'directories-pro' ),
			'RE' => __( 'Reunion', 'directories-pro' ),
			'RO' => __( 'Romania', 'directories-pro' ),
			'RU' => __( 'Russian Federation', 'directories-pro' ),
			'RW' => __( 'Rwanda', 'directories-pro' ),
			'BL' => __( 'Saint Barthelemy', 'directories-pro' ),
			'SH' => __( 'Saint Helena', 'directories-pro' ),
			'KN' => __( 'Saint Kitts And Nevis', 'directories-pro' ),
			'LC' => __( 'Saint Lucia', 'directories-pro' ),
			'MF' => __( 'Saint Martin', 'directories-pro' ),
			'PM' => __( 'Saint Pierre And Miquelon', 'directories-pro' ),
			'VC' => __( 'Saint Vincent And Grenadines', 'directories-pro' ),
			'WS' => __( 'Samoa', 'directories-pro' ),
			'SM' => __( 'San Marino', 'directories-pro' ),
			'ST' => __( 'Sao Tome And Principe', 'directories-pro' ),
			'SA' => __( 'Saudi Arabia', 'directories-pro' ),
			'SN' => __( 'Senegal', 'directories-pro' ),
			'RS' => __( 'Serbia', 'directories-pro' ),
			'SC' => __( 'Seychelles', 'directories-pro' ),
			'SL' => __( 'Sierra Leone', 'directories-pro' ),
			'SG' => __( 'Singapore', 'directories-pro' ),
			'SK' => __( 'Slovakia', 'directories-pro' ),
			'SI' => __( 'Slovenia', 'directories-pro' ),
			'SB' => __( 'Solomon Islands', 'directories-pro' ),
			'SO' => __( 'Somalia', 'directories-pro' ),
			'ZA' => __( 'South Africa', 'directories-pro' ),
			'GS' => __( 'South Georgia And Sandwich Isl.', 'directories-pro' ),
			'ES' => __( 'Spain', 'directories-pro' ),
			'LK' => __( 'Sri Lanka', 'directories-pro' ),
			'SD' => __( 'Sudan', 'directories-pro' ),
			'SR' => __( 'Suriname', 'directories-pro' ),
			'SJ' => __( 'Svalbard And Jan Mayen', 'directories-pro' ),
			'SZ' => __( 'Swaziland', 'directories-pro' ),
			'SE' => __( 'Sweden', 'directories-pro' ),
			'CH' => __( 'Switzerland', 'directories-pro' ),
			'SY' => __( 'Syrian Arab Republic', 'directories-pro' ),
			'TW' => __( 'Taiwan', 'directories-pro' ),
			'TJ' => __( 'Tajikistan', 'directories-pro' ),
			'TZ' => __( 'Tanzania', 'directories-pro' ),
			'TH' => __( 'Thailand', 'directories-pro' ),
			'TL' => __( 'Timor-Leste', 'directories-pro' ),
			'TG' => __( 'Togo', 'directories-pro' ),
			'TK' => __( 'Tokelau', 'directories-pro' ),
			'TO' => __( 'Tonga', 'directories-pro' ),
			'TT' => __( 'Trinidad And Tobago', 'directories-pro' ),
			'TN' => __( 'Tunisia', 'directories-pro' ),
			'TR' => __( 'Turkey', 'directories-pro' ),
			'TM' => __( 'Turkmenistan', 'directories-pro' ),
			'TC' => __( 'Turks And Caicos Islands', 'directories-pro' ),
			'TV' => __( 'Tuvalu', 'directories-pro' ),
			'UG' => __( 'Uganda', 'directories-pro' ),
			'UA' => __( 'Ukraine', 'directories-pro' ),
			'AE' => __( 'United Arab Emirates', 'directories-pro' ),
			'GB' => __( 'United Kingdom', 'directories-pro' ),
			'US' => __( 'United States', 'directories-pro' ),
			'UM' => __( 'United States Outlying Islands', 'directories-pro' ),
			'UY' => __( 'Uruguay', 'directories-pro' ),
			'UZ' => __( 'Uzbekistan', 'directories-pro' ),
			'VU' => __( 'Vanuatu', 'directories-pro' ),
			'VE' => __( 'Venezuela', 'directories-pro' ),
			'VN' => __( 'Viet Nam', 'directories-pro' ),
			'VG' => __( 'British Virgin Islands', 'directories-pro' ),
			'VI' => __( 'U.S. Virgin Islands', 'directories-pro' ),
			'WF' => __( 'Wallis And Futuna', 'directories-pro' ),
			'EH' => __( 'Western Sahara', 'directories-pro' ),
			'YE' => __( 'Yemen', 'directories-pro' ),
			'ZM' => __( 'Zambia', 'directories-pro' ),
			'ZW' => __( 'Zimbabwe', 'directories-pro' ),
		);
		if ( isset( $code ) ) {
			return isset( $ret[ $code ] ) ? $ret[ $code ] : null;
		}

		asort( $ret, SORT_LOCALE_STRING );

		return $ret;
	}

	/**
	 * Returns an array of country codes and international phone codes.
	 *
	 * @return array
	 */
	public function phone() {
		return array(
			'AF' => '+93',
			'AL' => '+355',
			'DZ' => '+213',
			'AS' => '+1',
			'AD' => '+376',
			'AO' => '+244',
			'AI' => '+1',
			'AG' => '+1',
			'AR' => '+54',
			'AM' => '+374',
			'AW' => '+297',
			'AU' => '+61',
			'AT' => '+43',
			'AZ' => '+994',
			'BH' => '+973',
			'BD' => '+880',
			'BB' => '+1',
			'BY' => '+375',
			'BE' => '+32',
			'BZ' => '+501',
			'BJ' => '+229',
			'BM' => '+1',
			'BT' => '+975',
			'BO' => '+591',
			'BA' => '+387',
			'BW' => '+267',
			'BR' => '+55',
			'IO' => '+246',
			'VG' => '+1',
			'BN' => '+673',
			'BG' => '+359',
			'BF' => '+226',
			'MM' => '+95',
			'BI' => '+257',
			'KH' => '+855',
			'CM' => '+237',
			'CA' => '+1',
			'CV' => '+238',
			'KY' => '+1',
			'CF' => '+236',
			'TD' => '+235',
			'CL' => '+56',
			'CN' => '+86',
			'CO' => '+57',
			'KM' => '+269',
			'CK' => '+682',
			'CR' => '+506',
			'CI' => '+225',
			'HR' => '+385',
			'CU' => '+53',
			'CY' => '+357',
			'CZ' => '+420',
			'CD' => '+243',
			'DK' => '+45',
			'DJ' => '+253',
			'DM' => '+1',
			'DO' => '+1',
			'EC' => '+593',
			'EG' => '+20',
			'SV' => '+503',
			'GQ' => '+240',
			'ER' => '+291',
			'EE' => '+372',
			'ET' => '+251',
			'FK' => '+500',
			'FO' => '+298',
			'FM' => '+691',
			'FJ' => '+679',
			'FI' => '+358',
			'FR' => '+33',
			'GF' => '+594',
			'PF' => '+689',
			'GA' => '+241',
			'GE' => '+995',
			'DE' => '+49',
			'GH' => '+233',
			'GI' => '+350',
			'GR' => '+30',
			'GL' => '+299',
			'GD' => '+1',
			'GP' => '+590',
			'GU' => '+1',
			'GT' => '+502',
			'GN' => '+224',
			'GW' => '+245',
			'GY' => '+592',
			'HT' => '+509',
			'HN' => '+504',
			'HK' => '+852',
			'HU' => '+36',
			'IS' => '+354',
			'IN' => '+91',
			'ID' => '+62',
			'IR' => '+98',
			'IQ' => '+964',
			'IE' => '+353',
			'IL' => '+972',
			'IT' => '+39',
			'JM' => '+1',
			'JP' => '+81',
			'JO' => '+962',
			'KZ' => '+7',
			'KE' => '+254',
			'KI' => '+686',
			'XK' => '+381',
			'KW' => '+965',
			'KG' => '+996',
			'LA' => '+856',
			'LV' => '+371',
			'LB' => '+961',
			'LS' => '+266',
			'LR' => '+231',
			'LY' => '+218',
			'LI' => '+423',
			'LT' => '+370',
			'LU' => '+352',
			'MO' => '+853',
			'MK' => '+389',
			'MG' => '+261',
			'MW' => '+265',
			'MY' => '+60',
			'MV' => '+960',
			'ML' => '+223',
			'MT' => '+356',
			'MH' => '+692',
			'MQ' => '+596',
			'MR' => '+222',
			'MU' => '+230',
			'YT' => '+262',
			'MX' => '+52',
			'MD' => '+373',
			'MC' => '+377',
			'MN' => '+976',
			'ME' => '+382',
			'MS' => '+1',
			'MA' => '+212',
			'MZ' => '+258',
			'NA' => '+264',
			'NR' => '+674',
			'NP' => '+977',
			'NL' => '+31',
			'AN' => '+599',
			'NC' => '+687',
			'NZ' => '+64',
			'NI' => '+505',
			'NE' => '+227',
			'NG' => '+234',
			'NU' => '+683',
			'NF' => '+672',
			'KP' => '+850',
			'MP' => '+1',
			'NO' => '+47',
			'OM' => '+968',
			'PK' => '+92',
			'PW' => '+680',
			'PS' => '+970',
			'PA' => '+507',
			'PG' => '+675',
			'PY' => '+595',
			'PE' => '+51',
			'PH' => '+63',
			'PL' => '+48',
			'PT' => '+351',
			'PR' => '+1',
			'QA' => '+974',
			'CG' => '+242',
			'RE' => '+262',
			'RO' => '+40',
			'RU' => '+7',
			'RW' => '+250',
			'BL' => '+590',
			'SH' => '+290',
			'KN' => '+1',
			'MF' => '+590',
			'PM' => '+508',
			'VC' => '+1',
			'WS' => '+685',
			'SM' => '+378',
			'ST' => '+239',
			'SA' => '+966',
			'SN' => '+221',
			'RS' => '+381',
			'SC' => '+248',
			'SL' => '+232',
			'SG' => '+65',
			'SK' => '+421',
			'SI' => '+386',
			'SB' => '+677',
			'SO' => '+252',
			'ZA' => '+27',
			'KR' => '+82',
			'ES' => '+34',
			'LK' => '+94',
			'LC' => '+1',
			'SD' => '+249',
			'SR' => '+597',
			'SZ' => '+268',
			'SE' => '+46',
			'CH' => '+41',
			'SY' => '+963',
			'TW' => '+886',
			'TJ' => '+992',
			'TZ' => '+255',
			'TH' => '+66',
			'BS' => '+1',
			'GM' => '+220',
			'TL' => '+670',
			'TG' => '+228',
			'TK' => '+690',
			'TO' => '+676',
			'TT' => '+1',
			'TN' => '+216',
			'TR' => '+90',
			'TM' => '+993',
			'TC' => '+1',
			'TV' => '+688',
			'UG' => '+256',
			'UA' => '+380',
			'AE' => '+971',
			'GB' => '+44',
			'US' => '+1',
			'UY' => '+598',
			'VI' => '+1',
			'UZ' => '+998',
			'VU' => '+678',
			'VA' => '+39',
			'VE' => '+58',
			'VN' => '+84',
			'WF' => '+681',
			'YE' => '+967',
			'ZM' => '+260',
			'ZW' => '+263',
		);
	}
}
