diff --git a/phpunit.xml b/phpunit.xml index 12bee7a..e89ac6d 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,18 +1,18 @@ - - - - - ./tests/ - - + + + + + ./tests/ + + \ No newline at end of file diff --git a/src/Vinelab/Country/CountryServiceProvider.php b/src/Vinelab/Country/CountryServiceProvider.php index 0487ac2..f9a7502 100644 --- a/src/Vinelab/Country/CountryServiceProvider.php +++ b/src/Vinelab/Country/CountryServiceProvider.php @@ -1,53 +1,49 @@ -package('vinelab/country'); - } - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - $this->app->bind('vinelab.country', function() - { - return new Guide($this->app['config']); - }); - - $this->app->booting(function() { - - $loader = \Illuminate\Foundation\AliasLoader::getInstance(); - $loader->alias('Country', 'Vinelab\Country\Facades\Guide'); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array(); - } - -} \ No newline at end of file +package('vinelab/country'); + } + + /** + * Register the service provider. + */ + public function register() + { + $this->app->bind('vinelab.country', function () { + return new Guide($this->app['config']); + }); + + $this->app->booting(function () { + + $loader = \Illuminate\Foundation\AliasLoader::getInstance(); + $loader->alias('Country', 'Vinelab\Country\Facades\Guide'); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return array(); + } +} diff --git a/src/Vinelab/Country/Facades/Guide.php b/src/Vinelab/Country/Facades/Guide.php index 2da0a1e..76273a6 100644 --- a/src/Vinelab/Country/Facades/Guide.php +++ b/src/Vinelab/Country/Facades/Guide.php @@ -1,14 +1,18 @@ -config = $config; - } +class Guide +{ + public function __construct(\Illuminate\Config\Repository $config) + { + $this->config = $config; + } - public function name($abbreviation) - { - $abbreviation = strtoupper($abbreviation); - return $this->config->get("country::countries.{$abbreviation}"); - } + public function name($abbreviation) + { + $abbreviation = strtoupper($abbreviation); - public function abbreviation($name) - { - $countries = $this->config->get('country::countries'); - return array_search(ucwords($name), $countries); - } + return $this->config->get("country::countries.{$abbreviation}"); + } - public function all() - { - return $this->config->get('country::countries'); - } -} \ No newline at end of file + public function abbreviation($name) + { + $countries = $this->config->get('country::countries'); + + return array_search(ucwords($name), $countries); + } + + public function all() + { + return $this->config->get('country::countries'); + } +} diff --git a/src/config/countries.php b/src/config/countries.php index f3ebf99..21479e7 100644 --- a/src/config/countries.php +++ b/src/config/countries.php @@ -1,6 +1,6 @@ 'Andorra', 'AE' => 'United Arab Emirates', 'AF' => 'Afghanistan', @@ -265,4 +265,4 @@ 'ZM' => 'Zambia', 'ZW' => 'Zimbabwe', 'ZZ' => 'Unknown or Invalid Region', -); \ No newline at end of file +);