Skip to content

Commit

Permalink
Merge pull request #3 from ARCANEDEV/feature-1
Browse files Browse the repository at this point in the history
Updating service providers + cleaning
  • Loading branch information
arcanedev-maroc committed Apr 18, 2016
2 parents bbe6d6b + a1242fc commit b8c901e
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/examples export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
Expand Down
13 changes: 12 additions & 1 deletion src/PackageServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ abstract class PackageServiceProvider extends ServiceProvider
*
* @var string
*/
protected $vendor = 'vendor';
protected $vendor = 'arcanedev';

/**
* Package name.
Expand Down Expand Up @@ -148,6 +148,17 @@ private function registerMultipleConfigs($separator = '.')
}
}

/**
* Register commands service provider.
*
* @param \Illuminate\Support\ServiceProvider|string $provider
*/
protected function registerCommands($provider)
{
if ($this->app->runningInConsole())
$this->app->register($provider);
}

/**
* Publish the config file.
*/
Expand Down
16 changes: 5 additions & 11 deletions src/Providers/CommandServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ abstract class CommandServiceProvider extends ServiceProvider
*
* @var string
*/
protected $vendor = '';
protected $vendor = 'arcanedev';

/**
* Package name.
Expand Down Expand Up @@ -56,13 +56,9 @@ protected function getCommandPrefix()
{
$this->checkPackageName();

$prefix = $this->package;

if ( ! empty($this->vendor)) {
$prefix = "{$this->vendor}.$prefix";
}

return $prefix;
return empty($this->vendor)
? $this->package
: "{$this->vendor}.{$this->package}";
}

/**
Expand All @@ -74,9 +70,7 @@ protected function getCommandPrefix()
*/
protected function getAbstractCommandName($name)
{
$prefix = $this->getCommandPrefix();

return "$prefix.commands.$name";
return $this->getCommandPrefix() . ".commands.$name";
}

/* ------------------------------------------------------------------------------------------------
Expand Down
28 changes: 28 additions & 0 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,34 @@ protected function alias($class, $alias)
return $this;
}

/* ------------------------------------------------------------------------------------------------
| Services
| ------------------------------------------------------------------------------------------------
*/
/**
* Get the config repository instance.
*
* @return \Illuminate\Config\Repository
*/
protected function config()
{
return $this->app['config'];
}

/**
* Get the filesystem instance.
*
* @return \Illuminate\Filesystem\Filesystem
*/
protected function filesystem()
{
return $this->app['files'];
}

/* ------------------------------------------------------------------------------------------------
| Deprecated Methods
| ------------------------------------------------------------------------------------------------
*/
/**
* Add Aliases into the app.
*
Expand Down
2 changes: 0 additions & 2 deletions tests/Stubs/TestPackageServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ class TestPackageServiceProvider extends PackageServiceProvider
| Properties
| ------------------------------------------------------------------------------------------------
*/
protected $vendor = 'arcanedev';

protected $package = 'package';

/* ------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit b8c901e

Please sign in to comment.