From 5ba2dcf771cd10ee05f3f5882b63611d9e685334 Mon Sep 17 00:00:00 2001 From: sameer-shelavale Date: Tue, 16 Dec 2014 14:13:16 +0530 Subject: [PATCH] restructured and updated the terminologies, added namespace --- composer.json | 10 +++++++++- sample/sample1.php | 12 +++++++----- CountryArray.php => src/CountriesArray.php | 3 ++- 3 files changed, 18 insertions(+), 7 deletions(-) rename CountryArray.php => src/CountriesArray.php (99%) diff --git a/composer.json b/composer.json index 5809001..c1328bc 100644 --- a/composer.json +++ b/composer.json @@ -12,5 +12,13 @@ "name": "Sameer Shelavale", "email": "samiirds@gmail.com" } - ] + ], + "autoload": { + "psr-0": { + "SameerShelavale\\PhpCountriesArray\\" : "src/" + }, + "psr-4": { + "SameerShelavale\\PhpCountriesArray\\" : "src/" + } + } } \ No newline at end of file diff --git a/sample/sample1.php b/sample/sample1.php index 079c6f5..0b6043a 100644 --- a/sample/sample1.php +++ b/sample/sample1.php @@ -5,20 +5,22 @@ * Date: 12/15/14 * Time: 8:50 PM */ -include( "../CountryArray.php" ); +use SameerShelavale\PhpCountriesArray\CountriesArray; +include( "../src/CountriesArray.php" ); -$countries = CountryArray::get(); + +$countries = CountriesArray::get(); var_dump( $countries ); -$countries = CountryArray::get2d( 'alpha3' ); +$countries = CountriesArray::get2d( 'alpha3' ); var_dump( $countries ); -$countries = CountryArray::get2d( 'alpha3', array( 'name', 'isd', 'continent' ) ); +$countries = CountriesArray::get2d( 'alpha3', array( 'name', 'isd', 'continent' ) ); var_dump( $countries ); -$countries = CountryArray::get2d( null, array( 'name', 'num', 'isd', 'continent' ) ); +$countries = CountriesArray::get2d( null, array( 'name', 'num', 'isd', 'continent' ) ); var_dump( $countries ); \ No newline at end of file diff --git a/CountryArray.php b/src/CountriesArray.php similarity index 99% rename from CountryArray.php rename to src/CountriesArray.php index 96760e6..c518ca7 100644 --- a/CountryArray.php +++ b/src/CountriesArray.php @@ -17,8 +17,9 @@ * License: AGPL3, You should keep Package name, Class name, Author name, Email and website credits. * Copyrights (C) Sameer Shelavale *******************************************************************************************************/ +namespace SameerShelavale\PhpCountriesArray; -class CountryArray{ +class CountriesArray{ public static $countries = array( "AF" => array( 'alpha2'=>'AF', 'alpha3'=>'AFG', 'num'=>'004', 'isd'=> '93', "name" => "Afghanistan", "continent" => "Asia", ),