-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
108 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
syntaxCheck="false" | ||
> | ||
<testsuites> | ||
<testsuite name="Package Test Suite"> | ||
<directory suffix=".php">./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
syntaxCheck="false" | ||
> | ||
<testsuites> | ||
<testsuite name="Package Test Suite"> | ||
<directory suffix=".php">./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,49 @@ | ||
<?php namespace Vinelab\Country; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
|
||
class CountryServiceProvider extends ServiceProvider { | ||
|
||
/** | ||
* Indicates if loading of the provider is deferred. | ||
* | ||
* @var bool | ||
*/ | ||
protected $defer = false; | ||
|
||
/** | ||
* Bootstrap the application events. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
$this->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(); | ||
} | ||
|
||
} | ||
<?php | ||
|
||
namespace Vinelab\Country; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
|
||
class CountryServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Indicates if loading of the provider is deferred. | ||
* | ||
* @var bool | ||
*/ | ||
protected $defer = false; | ||
|
||
/** | ||
* Bootstrap the application events. | ||
*/ | ||
public function boot() | ||
{ | ||
$this->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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
<?php namespace Vinelab\Country\Facades; | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
Class Guide extends Facade { | ||
namespace Vinelab\Country\Facades; | ||
|
||
/** | ||
* Get the registered name of the component. | ||
* | ||
* @return string | ||
*/ | ||
protected static function getFacadeAccessor() { return 'vinelab.country'; } | ||
use Illuminate\Support\Facades\Facade; | ||
|
||
} | ||
class Guide extends Facade | ||
{ | ||
/** | ||
* Get the registered name of the component. | ||
* | ||
* @return string | ||
*/ | ||
protected static function getFacadeAccessor() | ||
{ | ||
return 'vinelab.country'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,30 @@ | ||
<?php namespace Vinelab\Country; | ||
<?php | ||
|
||
Class Guide { | ||
namespace Vinelab\Country; | ||
|
||
function __construct(\Illuminate\Config\Repository $config) | ||
{ | ||
$this->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'); | ||
} | ||
} | ||
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'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters