Skip to content

Commit

Permalink
Move bootUsingLaravel() to trait and add hasPackageRepository().
Browse files Browse the repository at this point in the history
Signed-off-by: crynobone <crynobone@gmail.com>
  • Loading branch information
crynobone committed Mar 18, 2015
1 parent 814723c commit 71d08be
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
12 changes: 0 additions & 12 deletions src/Providers/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,4 @@
abstract class ServiceProvider extends BaseServiceProvider
{
use PackageProviderTrait;

/**
* Boot under Laravel setup.
*
* @param string $path
*
* @return void
*/
protected function bootUsingLaravel($path)
{
//
}
}
28 changes: 24 additions & 4 deletions src/Providers/Traits/PackageProviderTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ trait PackageProviderTrait
*/
public function addConfigComponent($package, $namespace, $path)
{
$config = $this->app['config'];

if ($config instanceof PackageRepository) {
$config->package($package, $path, $namespace);
if ($this->hasPackageRepository()) {
$this->app['config']->package($package, $path, $namespace);
}
}

Expand Down Expand Up @@ -143,4 +141,26 @@ protected function getAppViewPaths($package)
return "{$path}/packages/{$package}";
}, $this->app['config']['view.paths']);
}

/**
* Has package repository available.
*
* @return bool
*/
protected function hasPackageRepository()
{
return ($this->app['config'] instanceof PackageRepository);
}

/**
* Boot under Laravel setup.
*
* @param string $path
*
* @return void
*/
protected function bootUsingLaravel($path)
{
//
}
}

0 comments on commit 71d08be

Please sign in to comment.