Conditions | 1 |
Paths | 1 |
Total Lines | 74 |
Code Lines | 45 |
Lines | 0 |
Ratio | 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 |
||
41 | public function getScheme(Builder $builder) |
||
42 | { |
||
43 | return $builder->group([ |
||
44 | 'checkbox' => $builder->checkbox()->label('Checkbox'), |
||
45 | |||
46 | 'choose' => $builder->choose([ |
||
47 | 1 => $builder->radio()->label('Radio 1'), |
||
48 | 2 => $builder->radio()->label('Radio 2'), |
||
49 | ])->label('Choose'), |
||
50 | |||
51 | 'code' => $builder->code()->label('Code'), |
||
52 | |||
53 | 'collection' => $builder->collection([ |
||
54 | 'text' => $builder->text()->label('Text'), |
||
55 | 'textarea' => $builder->textarea()->label('Textarea'), |
||
56 | ])->label('Collection'), |
||
57 | |||
58 | 'collectionMultiple' => $builder->collectionMultiple([ |
||
59 | 'text' => [ |
||
60 | 'text' => $builder->text()->label('Text'), |
||
61 | 'textarea' => $builder->textarea()->label('Textarea'), |
||
62 | ], |
||
63 | 'image' => [ |
||
64 | 'text' => $builder->imageupload()->label('Image'), |
||
65 | ], |
||
66 | ])->label('Collection multiple'), |
||
67 | |||
68 | 'color' => $builder->color()->label('Color'), |
||
69 | |||
70 | 'date' => $builder->date()->label('Date'), |
||
71 | |||
72 | 'datetime' => $builder->datetime()->label('Datetime'), |
||
73 | |||
74 | 'datetimeLocal' => $builder->datetimeLocal()->label('Datetime local'), |
||
75 | |||
76 | 'email' => $builder->email()->label('Email'), |
||
77 | |||
78 | 'fileupload' => $builder->fileupload()->label('File upload'), |
||
79 | |||
80 | 'html' => $builder->html()->label('Html'), |
||
81 | |||
82 | 'imageupload' => $builder->imageupload()->label('Image upload'), |
||
83 | |||
84 | 'info' => $builder->info()->label('Info'), |
||
85 | |||
86 | 'loader' => $builder->loader([ |
||
87 | 'field' => $builder->url()->label('Url'), |
||
88 | 'loader' => $builder->text()->label('Text'), |
||
89 | ])->label('Loader'), |
||
90 | |||
91 | 'month' => $builder->month()->label('Month'), |
||
92 | |||
93 | 'number' => $builder->number()->label('Number'), |
||
94 | |||
95 | 'password' => $builder->password()->label('Password'), |
||
96 | |||
97 | 'range' => $builder->range()->label('Range'), |
||
98 | |||
99 | 'select' => $builder->select([ |
||
100 | 1 => 'One', |
||
101 | 2 => 'Two', |
||
102 | ])->label('Select'), |
||
103 | |||
104 | 'table' => $builder->table()->label('Table'), |
||
105 | |||
106 | 'tel' => $builder->tel()->label('Tel'), |
||
107 | |||
108 | 'time' => $builder->time()->label('Time'), |
||
109 | |||
110 | 'url' => $builder->url()->label('Url'), |
||
111 | |||
112 | 'week' => $builder->week()->label('Week'), |
||
113 | ]); |
||
114 | } |
||
115 | } |
||
116 |