We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Conditions | 1 |
Paths | 1 |
Total Lines | 56 |
Code Lines | 36 |
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 |
||
18 | public function __construct($name, $controller, $options) |
||
19 | { |
||
20 | $this->name = $name; |
||
21 | $this->options = $options; |
||
22 | $this->controller = $controller; |
||
23 | |||
24 | // CRUD routes for core features |
||
25 | Route::post($this->name.'/search', [ |
||
26 | 'as' => 'crud.'.$this->name.'.search', |
||
27 | 'uses' => $this->controller.'@search', |
||
28 | ]); |
||
29 | |||
30 | Route::get($this->name.'/reorder', [ |
||
31 | 'as' => 'crud.'.$this->name.'.reorder', |
||
32 | 'uses' => $this->controller.'@reorder', |
||
33 | ]); |
||
34 | |||
35 | Route::post($this->name.'/reorder', [ |
||
36 | 'as' => 'crud.'.$this->name.'.save.reorder', |
||
37 | 'uses' => $this->controller.'@saveReorder', |
||
38 | ]); |
||
39 | |||
40 | Route::get($this->name.'/{id}/details', [ |
||
41 | 'as' => 'crud.'.$this->name.'.showDetailsRow', |
||
42 | 'uses' => $this->controller.'@showDetailsRow', |
||
43 | ]); |
||
44 | |||
45 | Route::get($this->name.'/{id}/translate/{lang}', [ |
||
46 | 'as' => 'crud.'.$this->name.'.translateItem', |
||
47 | 'uses' => $this->controller.'@translateItem', |
||
48 | ]); |
||
49 | |||
50 | Route::get($this->name.'/{id}/revisions', [ |
||
51 | 'as' => 'crud.'.$this->name.'.listRevisions', |
||
52 | 'uses' => $this->controller.'@listRevisions', |
||
53 | ]); |
||
54 | |||
55 | Route::post($this->name.'/{id}/revisions/{revisionId}/restore', [ |
||
56 | 'as' => 'crud.'.$this->name.'.restoreRevision', |
||
57 | 'uses' => $this->controller.'@restoreRevision', |
||
58 | ]); |
||
59 | |||
60 | $options_with_default_route_names = array_merge([ |
||
61 | 'names' => [ |
||
62 | 'index' => 'crud.'.$this->name.'.index', |
||
63 | 'create' => 'crud.'.$this->name.'.create', |
||
64 | 'store' => 'crud.'.$this->name.'.store', |
||
65 | 'edit' => 'crud.'.$this->name.'.edit', |
||
66 | 'update' => 'crud.'.$this->name.'.update', |
||
67 | 'show' => 'crud.'.$this->name.'.show', |
||
68 | 'destroy' => 'crud.'.$this->name.'.destroy', |
||
69 | ], |
||
70 | ], $this->options); |
||
71 | |||
72 | Route::resource($this->name, $this->controller, $options_with_default_route_names); |
||
73 | } |
||
74 | |||
127 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.