Conditions | 12 |
Paths | 22 |
Total Lines | 69 |
Code Lines | 52 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
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 |
||
92 | public function getWidget() |
||
93 | { |
||
94 | $W = bab_Widgets(); |
||
95 | $App = $this->App(); |
||
96 | |||
97 | switch ($this->fieldtype) { |
||
98 | case 'Text': |
||
99 | $widget = $W->TextEdit() |
||
100 | ->setLines(3) |
||
101 | ->setColumns(70); |
||
102 | break; |
||
103 | |||
104 | case 'Bool': |
||
105 | $widget = $W->Checkbox(); |
||
106 | break; |
||
107 | |||
108 | case 'Enum': |
||
109 | $options = array( |
||
110 | '' => '' |
||
111 | ) + $this->getEnumValues(); |
||
112 | $widget = $W->Select()->setOptions($options); |
||
113 | break; |
||
114 | |||
115 | case 'Date': |
||
116 | $widget = $W->DatePicker(); |
||
117 | break; |
||
118 | |||
119 | case 'DateTime': |
||
120 | $widget = $W->DateTimePicker(); |
||
121 | break; |
||
122 | |||
123 | case 'Int': |
||
124 | $widget = $W->RegExpLineEdit(); |
||
125 | $widget->setRegExp(WidgetRegExpLineEdit::INT_FORMAT) |
||
126 | ->setSubmitMessage(sprintf($App->translate('The field %s should be a integer number'), $this->name)) |
||
127 | ->setSize(10); |
||
128 | break; |
||
129 | |||
130 | case 'Decimal': |
||
131 | $widget = $W->RegExpLineEdit(); |
||
132 | $widget->setRegExp(WidgetRegExpLineEdit::FLOAT_FORMAT) |
||
133 | ->setSubmitMessage(sprintf($App->translate('The field %s should be a decimal number'), $this->name)) |
||
134 | ->setSize(10); |
||
135 | break; |
||
136 | |||
137 | case 'Url': |
||
138 | $widget = $W->UrlLineEdit(); |
||
139 | break; |
||
140 | |||
141 | case 'Email': |
||
142 | $widget = $W->EmailLineEdit(); |
||
143 | break; |
||
144 | |||
145 | default: |
||
146 | case 'String': |
||
147 | $widget = $W->LineEdit() |
||
148 | ->setSize(70) |
||
149 | ->setMaxSize(255); |
||
150 | break; |
||
151 | } |
||
152 | |||
153 | $labelledItem = $W->LabelledWidget($this->name, $widget, null); |
||
154 | $labelledItem->setName($this->fieldname); |
||
155 | |||
156 | if(! empty($this->description)){ |
||
157 | $labelledItem->setDescription($this->description); |
||
158 | } |
||
159 | |||
160 | return $labelledItem; |
||
161 | } |
||
163 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths