Skip to content

Commit

Permalink
Merge pull request #3 from yemenifree/analysis-XVA4pw
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
salkhwlani authored Oct 4, 2017
2 parents fdb7018 + ce268c0 commit bee924a
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 bee924a

Please sign in to comment.