@@ -32,7 +32,7 @@ |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
35 | - * @return mixed |
|
35 | + * @return \Symfony\Component\HttpFoundation\Response |
|
36 | 36 | */ |
37 | 37 | public function index() |
38 | 38 | { |
@@ -67,7 +67,7 @@ |
||
67 | 67 | { |
68 | 68 | $id = $request->id; |
69 | 69 | |
70 | - if (! $this->repository->exists($id)) { |
|
70 | + if (!$this->repository->exists($id)) { |
|
71 | 71 | return response(null, 404); |
72 | 72 | } |
73 | 73 |
@@ -2,12 +2,12 @@ |
||
2 | 2 | |
3 | 3 | namespace Loadsman\LaravelPlugin\Http\Controllers; |
4 | 4 | |
5 | +use Illuminate\Http\Request; |
|
6 | +use Illuminate\Routing\Controller; |
|
5 | 7 | use Loadsman\LaravelPlugin\Contracts\RequestRepositoryInterface; |
6 | 8 | use Loadsman\LaravelPlugin\Entities\RequestEntity; |
7 | 9 | use Loadsman\LaravelPlugin\Http\Requests\StoreRequest; |
8 | 10 | use Loadsman\LaravelPlugin\Http\Requests\UpdateRequest; |
9 | -use Illuminate\Http\Request; |
|
10 | -use Illuminate\Routing\Controller; |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Class RequestController |
@@ -7,9 +7,6 @@ |
||
7 | 7 | use Loadsman\LaravelPlugin\Modules\Rule\RuleRepository; |
8 | 8 | use Loadsman\LaravelPlugin\Modules\Rule\RuleServiceProvider; |
9 | 9 | use Loadsman\LaravelPlugin\Providers\MacroServiceProvider; |
10 | -use Loadsman\LaravelPlugin\Providers\RepositoryServiceProvider; |
|
11 | -use Loadsman\LaravelPlugin\Providers\RouteServiceProvider; |
|
12 | -use Illuminate\Routing\Router; |
|
13 | 10 | |
14 | 11 | class LoadsmanServiceProvider extends \Illuminate\Support\ServiceProvider |
15 | 12 | { |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | { |
18 | 18 | $this->mergeConfigFrom($this->getConfigPath(), 'loadsman'); |
19 | 19 | |
20 | - if (! $this->app['config']['loadsman.enabled']) { |
|
20 | + if (!$this->app['config']['loadsman.enabled']) { |
|
21 | 21 | return; |
22 | 22 | } |
23 | 23 | |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | $this->app->register(FrameworkServiceProvider::class); |
26 | 26 | $this->app->register(RuleServiceProvider::class); |
27 | 27 | |
28 | - $this->app->bind(RuleRepository::class, function (Container $app) { |
|
28 | + $this->app->bind(RuleRepository::class, function(Container $app) { |
|
29 | 29 | |
30 | 30 | $routers = []; |
31 | - foreach ($app['config']['loadsman.routers'] as $routerName){ |
|
31 | + foreach ($app['config']['loadsman.routers'] as $routerName) { |
|
32 | 32 | $routers[] = $app->make($routerName); |
33 | 33 | } |
34 | 34 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | // Laravel 5.2 event |
40 | 40 | $this->events->listen(RouteMatched::class, |
41 | - function (RouteMatched $event) { |
|
41 | + function(RouteMatched $event) { |
|
42 | 42 | $this->handleMatchedRoute($event->route); |
43 | 43 | }); |
44 | 44 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | return $next($request); |
47 | 47 | } |
48 | 48 | |
49 | - public function handleMatchedRoute($route){ |
|
49 | + public function handleMatchedRoute($route) { |
|
50 | 50 | $routeInfo = new RouteInfo($route); |
51 | 51 | |
52 | 52 | response()->json([ |
@@ -18,7 +18,7 @@ |
||
18 | 18 | ]; |
19 | 19 | } |
20 | 20 | |
21 | - public function authorize(){ |
|
21 | + public function authorize() { |
|
22 | 22 | return true; |
23 | 23 | } |
24 | 24 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | 'prefix' => config('api-tester.route'), |
31 | 31 | 'namespace' => $this->getNamespace(), |
32 | 32 | 'middleware' => $this->getMiddleware(), |
33 | - ], function () { |
|
33 | + ], function() { |
|
34 | 34 | $this->requireRoutes(); |
35 | 35 | }); |
36 | 36 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | protected function requireRoutes() |
75 | 75 | { |
76 | - require __DIR__ . '/../Http/routes.php'; |
|
76 | + require __DIR__.'/../Http/routes.php'; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -2,12 +2,11 @@ |
||
2 | 2 | |
3 | 3 | namespace Loadsman\LaravelPlugin\Providers; |
4 | 4 | |
5 | -use Loadsman\LaravelPlugin\Http\Middleware\DebugState; |
|
6 | -use Loadsman\LaravelPlugin\Http\Middleware\DetectRoute; |
|
7 | -use Loadsman\LaravelPlugin\Http\Middleware\PreventRedirect; |
|
8 | 5 | use Illuminate\Contracts\Http\Kernel; |
9 | 6 | use Illuminate\Routing\Router; |
10 | 7 | use Illuminate\Support\ServiceProvider; |
8 | +use Loadsman\LaravelPlugin\Http\Middleware\DetectRoute; |
|
9 | +use Loadsman\LaravelPlugin\Http\Middleware\PreventRedirect; |
|
11 | 10 | |
12 | 11 | class RouteServiceProvider extends ServiceProvider |
13 | 12 | { |
@@ -28,7 +28,7 @@ |
||
28 | 28 | */ |
29 | 29 | public function register() |
30 | 30 | { |
31 | - $this->app->singleton(RouteRepositoryInterface::class, function (Container $app) { |
|
31 | + $this->app->singleton(RouteRepositoryInterface::class, function(Container $app) { |
|
32 | 32 | $repositories = []; |
33 | 33 | foreach (config('api-tester.route_repositories') as $repository) { |
34 | 34 | $repositories[] = $app->make($repository); |
@@ -3,12 +3,12 @@ |
||
3 | 3 | namespace Loadsman\LaravelPlugin\Providers; |
4 | 4 | |
5 | 5 | |
6 | +use Illuminate\Contracts\Container\Container; |
|
7 | +use Illuminate\Support\ServiceProvider; |
|
6 | 8 | use Loadsman\LaravelPlugin\Collections\RouteCollection; |
7 | 9 | use Loadsman\LaravelPlugin\Contracts\RequestRepositoryInterface; |
8 | 10 | use Loadsman\LaravelPlugin\Contracts\RouteRepositoryInterface; |
9 | 11 | use Loadsman\LaravelPlugin\Repositories\RouteRepository; |
10 | -use Illuminate\Contracts\Container\Container; |
|
11 | -use Illuminate\Support\ServiceProvider; |
|
12 | 12 | |
13 | 13 | class RepositoryServiceProvider extends ServiceProvider |
14 | 14 | { |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * Present controller method as `post` route. |
16 | 16 | */ |
17 | 17 | app('router')->macro('expose', |
18 | - function ($controller = '', Array $actions) { |
|
18 | + function($controller = '', Array $actions) { |
|
19 | 19 | foreach ($actions as $action) { |
20 | 20 | $this->post(snake_case($action, '-'), |
21 | 21 | $controller.'@'.$action); |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | * Expose all public methods of controller. |
27 | 27 | * @see `expose` macro /\ |
28 | 28 | */ |
29 | - app('router')->macro('exposeAll', function ($controllerClassName) { |
|
29 | + app('router')->macro('exposeAll', function($controllerClassName) { |
|
30 | 30 | $controllerClassReflection = new \ReflectionClass($controllerClassName); |
31 | 31 | $publicActions = $controllerClassReflection->getMethods(\ReflectionMethod::IS_PUBLIC); |
32 | 32 | foreach ($publicActions as $publicAction) { |
33 | 33 | $declaringClass = $publicAction->getDeclaringClass()->getName(); |
34 | 34 | $isOwn = $declaringClass === $controllerClassName; |
35 | - if (! $isOwn) { |
|
35 | + if (!$isOwn) { |
|
36 | 36 | continue; |
37 | 37 | } |
38 | 38 | $action = $publicAction->getName(); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | - return $this->filter(function ($route) use ($patterns) { |
|
32 | + return $this->filter(function($route) use ($patterns) { |
|
33 | 33 | // If any of patterns matches - route passes. |
34 | 34 | foreach ($patterns as $pattern) { |
35 | 35 | if ($this->isRouteMatchesPattern($route, $pattern)) { |
@@ -69,17 +69,17 @@ discard block |
||
69 | 69 | private function isRouteMatchesPattern(array $route, array $pattern) |
70 | 70 | { |
71 | 71 | foreach ($route as $key => $value) { |
72 | - if (! array_key_exists($key, $pattern)) { |
|
72 | + if (!array_key_exists($key, $pattern)) { |
|
73 | 73 | continue; |
74 | 74 | } |
75 | 75 | |
76 | - if(is_array($value)){ |
|
76 | + if (is_array($value)) { |
|
77 | 77 | $value = implode(',', $value); |
78 | 78 | } |
79 | 79 | |
80 | 80 | $regex = '#'.$pattern[$key].'#'; |
81 | 81 | |
82 | - return ! ! preg_match($regex, $value); |
|
82 | + return !!preg_match($regex, $value); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | return true; |
@@ -21,7 +21,7 @@ |
||
21 | 21 | { |
22 | 22 | $routes = $this->router->getRoutes()->getRoutes(); |
23 | 23 | |
24 | - return array_map(function (Route $route) { |
|
24 | + return array_map(function(Route $route) { |
|
25 | 25 | return $this->transformer->cast($route); |
26 | 26 | }, $routes); |
27 | 27 | } |