| Conditions | 1 |
| Paths | 1 |
| Total Lines | 51 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php namespace Lahaxearnaud\U2f; |
||
| 20 | public function boot(Router $router) |
||
|
|
|||
| 21 | { |
||
| 22 | $routeConfig = [ |
||
| 23 | 'namespace' => '\Lahaxearnaud\U2f\Http\Controllers', |
||
| 24 | 'prefix' => '/u2f/', |
||
| 25 | 'middleware' => $this->app[ 'config' ]->get('u2f.authMiddlewareName', 'web') |
||
| 26 | ]; |
||
| 27 | |||
| 28 | $this->app[ 'router' ]->group($routeConfig, function(Router $router) { |
||
| 29 | $router->get('register', [ |
||
| 30 | 'uses' => 'U2fController@registerData', |
||
| 31 | 'as' => 'u2f.register.data', |
||
| 32 | 'middleware' => 'auth' |
||
| 33 | ]); |
||
| 34 | $router->post('register', [ |
||
| 35 | 'uses' => 'U2fController@register', |
||
| 36 | 'as' => 'u2f.register', |
||
| 37 | 'middleware' => 'auth' |
||
| 38 | ]); |
||
| 39 | |||
| 40 | $router->get('auth', [ |
||
| 41 | 'uses' => 'U2fController@authData', |
||
| 42 | 'as' => 'u2f.auth.data', |
||
| 43 | 'middleware' => 'auth' |
||
| 44 | ]); |
||
| 45 | $router->post('auth', [ |
||
| 46 | 'uses' => 'U2fController@auth', |
||
| 47 | 'as' => 'u2f.auth', |
||
| 48 | 'middleware' => 'auth' |
||
| 49 | ]); |
||
| 50 | }); |
||
| 51 | |||
| 52 | $this->publishes([ |
||
| 53 | __DIR__.'/../database/migrations/' => base_path('/database/migrations') |
||
| 54 | ], 'u2f-migrations'); |
||
| 55 | |||
| 56 | $this->publishes([ |
||
| 57 | __DIR__.'/../config/u2f.php' => config_path('u2f.php') |
||
| 58 | ], 'u2f-config'); |
||
| 59 | |||
| 60 | $this->publishes([ |
||
| 61 | __DIR__.'/../resources/js' => public_path('vendor/u2f'), |
||
| 62 | ], 'u2f-components'); |
||
| 63 | |||
| 64 | $this->publishes([ |
||
| 65 | __DIR__.'/../views' => resource_path('views/vendor/u2f'), |
||
| 66 | ], 'u2f-views'); |
||
| 67 | |||
| 68 | $this->loadViewsFrom(__DIR__.'/../views/', 'u2f'); |
||
| 69 | $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'u2f'); |
||
| 70 | } |
||
| 71 | |||
| 95 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.