Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
salkhwlani authored and StyleCIBot committed Oct 4, 2017
1 parent fdb7018 commit ce268c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
12 changes: 4 additions & 8 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ServiceProvider extends BaseServiceProvider
*/
protected $middleware = [
'arabic-to-eastern' => TransformArabicToEasternNumbers::class,
'eastern-to-arabic' => TransformEasternToArabicNumbers::class
'eastern-to-arabic' => TransformEasternToArabicNumbers::class,
];

/**
Expand All @@ -37,7 +37,6 @@ class ServiceProvider extends BaseServiceProvider
*/
protected $auto_middleware;


/**
* Perform post-registration booting of services.
*
Expand All @@ -52,7 +51,6 @@ public function boot()
$this->autoAppendMiddleware();
}


/**
* auto append middleware to router.
*/
Expand All @@ -67,19 +65,17 @@ protected function autoAppendMiddleware()

if ($this->groupMiddleware === true) { // Register middleware as global Middleware
$this->app->make('Illuminate\Contracts\Http\Kernel')->pushMiddleware($this->auto_middleware);
} else if (is_array($this->groupMiddleware) && count($this->groupMiddleware) > 0) { // Register Middleware for route group
} elseif (is_array($this->groupMiddleware) && count($this->groupMiddleware) > 0) { // Register Middleware for route group
$this->pushMiddlewareToGroups($this->auto_middleware);
}

return;
}

/**
* push middleware to route groups.
*
* @param $middleware
*/
function pushMiddlewareToGroups($middleware)
public function pushMiddlewareToGroups($middleware)
{
foreach ($this->groupMiddleware as $group) {
$this->app['router']->pushMiddlewareToGroup($group, $middleware);
Expand All @@ -106,4 +102,4 @@ protected function registerAliasMiddleware()
$this->app['router']->aliasMiddleware($alias, $middleware);
}
}
}
}
4 changes: 2 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Yemenifree\LaravelArabicNumbersMiddleware\Test;

use Illuminate\Foundation\Application;
use Illuminate\Http\Request;
use Illuminate\Routing\RouteCollection;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Application;
use Illuminate\Routing\RouteCollection;
use Orchestra\Testbench\TestCase as Orchestra;
use Yemenifree\LaravelArabicNumbersMiddleware\ServiceProvider;

Expand Down

0 comments on commit ce268c0

Please sign in to comment.