Conditions | 1 |
Paths | 1 |
Total Lines | 66 |
Code Lines | 55 |
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 |
||
14 | public function boot() |
||
15 | { |
||
16 | // Collective Form |
||
17 | Form::component('bsText', 'components.form.text', [ |
||
18 | 'name', |
||
19 | 'label' => null, |
||
20 | 'value' => null, |
||
21 | 'attributes' => [], |
||
22 | 'labelClass' => 'form-control-label' |
||
23 | ]); |
||
24 | Form::component('bsEmail', 'components.form.email', [ |
||
25 | 'name', |
||
26 | 'label' => null, |
||
27 | 'value' => null, |
||
28 | 'attributes' => [] |
||
29 | ]); |
||
30 | Form::component('bsNumber', 'components.form.number', [ |
||
31 | 'name', |
||
32 | 'label' => null, |
||
33 | 'value' => null, |
||
34 | 'attributes' => [] |
||
35 | ]); |
||
36 | Form::component('bsTextarea', 'components.form.textarea', [ |
||
37 | 'name', |
||
38 | 'label' => null, |
||
39 | 'value' => null, |
||
40 | 'attributes' => [], |
||
41 | 'labelClass' => 'form-control-label' |
||
42 | ]); |
||
43 | Form::component('bsPassword', 'components.form.password', ['name', 'label' => null, 'attributes' => []]); |
||
44 | Form::component('bsCheckbox', 'components.form.checkbox', [ |
||
45 | 'name', |
||
46 | 'value' => 1, |
||
47 | 'checked' => null, |
||
48 | 'label' => null, |
||
49 | 'attributes' => [], |
||
50 | 'labelClass' => 'form-control-label' |
||
51 | ]); |
||
52 | Form::component('bsRadio', 'components.form.radio', [ |
||
53 | 'name', |
||
54 | 'value' => 1, |
||
55 | 'checked' => null, |
||
56 | 'label' => null, |
||
57 | 'attributes' => [], |
||
58 | 'labelClass' => 'form-control-label' |
||
59 | ]); |
||
60 | Form::component('bsInputGroup', 'components.form.input-group', [ |
||
61 | 'name', |
||
62 | 'label' => null, |
||
63 | 'value' => null, |
||
64 | 'attributes' => [] |
||
65 | ]); |
||
66 | Form::component('bsSelect', 'components.form.select', [ |
||
67 | 'name', |
||
68 | 'list' => [], |
||
69 | 'label' => null, |
||
70 | 'selected' => null, |
||
71 | 'attributes' => [], |
||
72 | 'optionsAttributes' => [], |
||
73 | 'labelClass' => 'form-control-label' |
||
74 | ]); |
||
75 | Form::component('bsNewsletter', 'components.form.newsletter', [ |
||
76 | 'name', |
||
77 | 'label' => null, |
||
78 | 'value' => null, |
||
79 | 'attributes' => [] |
||
80 | ]); |
||
83 |