@@ -5,7 +5,6 @@ |
||
5 | 5 | use ArrayAccess; |
6 | 6 | use Illuminate\Contracts\Support\Arrayable; |
7 | 7 | use Illuminate\Contracts\Support\Jsonable; |
8 | -use Illuminate\Support\Arr; |
|
9 | 8 | use JsonSerializable; |
10 | 9 | |
11 | 10 | /** |
@@ -239,6 +239,10 @@ |
||
239 | 239 | return $this->route->uri(); |
240 | 240 | } |
241 | 241 | |
242 | + /** |
|
243 | + * @param string $type |
|
244 | + * @param string $text |
|
245 | + */ |
|
242 | 246 | protected function setError($type, $text, $params = []) |
243 | 247 | { |
244 | 248 | $this->errors[$type] = trans($text, $params); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | { |
110 | 110 | $reflection = $this->getActionReflection(); |
111 | 111 | |
112 | - if (! is_null($reflection)) { |
|
112 | + if (!is_null($reflection)) { |
|
113 | 113 | return $reflection->getDocComment(); |
114 | 114 | } |
115 | 115 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | // We don't care if argument is anything but FormRequest |
142 | - if (! is_subclass_of($class->name, FormRequest::class)) { |
|
142 | + if (!is_subclass_of($class->name, FormRequest::class)) { |
|
143 | 143 | continue; |
144 | 144 | } |
145 | 145 | |
@@ -188,14 +188,14 @@ discard block |
||
188 | 188 | list($controller, $action) = explode('@', $uses); |
189 | 189 | |
190 | 190 | // Controller is missing. |
191 | - if (! class_exists($controller)) { |
|
191 | + if (!class_exists($controller)) { |
|
192 | 192 | $this->setError('uses', 'controller does not exists'); |
193 | 193 | |
194 | 194 | return null; |
195 | 195 | } |
196 | 196 | |
197 | 197 | // Action is missing. |
198 | - if (! method_exists($controller, $action)) { |
|
198 | + if (!method_exists($controller, $action)) { |
|
199 | 199 | $this->setError('uses', 'controller@method does not exists'); |
200 | 200 | |
201 | 201 | return null; |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @return string |
231 | 231 | */ |
232 | - protected function getUri(){ |
|
233 | - if (method_exists($this->route, 'getPath')){ |
|
232 | + protected function getUri() { |
|
233 | + if (method_exists($this->route, 'getPath')) { |
|
234 | 234 | // Laravel <5.4 |
235 | 235 | return $this->route->getPath(); |
236 | 236 | } |
@@ -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 |
@@ -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 |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Loadsman\LaravelPlugin\Providers; |
4 | 4 | |
5 | -use Loadsman\LaravelPlugin\Http\Middleware\DebugState; |
|
6 | 5 | use Loadsman\LaravelPlugin\Http\Middleware\DetectRoute; |
7 | 6 | use Loadsman\LaravelPlugin\Http\Middleware\PreventRedirect; |
8 | 7 | use Illuminate\Contracts\Http\Kernel; |
@@ -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 | /** |
@@ -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 | } |
@@ -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); |
@@ -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(); |