Conditions | 16 |
Paths | 720 |
Total Lines | 62 |
Code Lines | 42 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 |
||
34 | public function RenderHtml() |
||
35 | { |
||
36 | |||
37 | $html = ''; |
||
38 | $multiple=false; |
||
39 | |||
40 | if (!$this->Attributes()->has('id')) |
||
41 | $this->Attributes()->createElementID($this->Attributes()->get('name', $this->label()->getItemID())); |
||
42 | $this->label()->Attribute()->set('fieldtype', $this->Attributes()->get('type')); |
||
43 | $this->label()->Attribute()->set('for', $this->Attributes()->get('id')); |
||
44 | |||
45 | |||
46 | if($this->Attributes()->has('value')) |
||
47 | { |
||
48 | if(!is_array($this->Attributes()->get('value'))) |
||
49 | $this->Attributes()->set('value',[$this->Attributes()->get('value')]); |
||
50 | } |
||
51 | else |
||
52 | $this->Attributes()->set('value',[]); |
||
53 | |||
54 | if($this->Attributes()->has('multiple') AND $this->Attributes()->get('multiple')==='multiple') |
||
55 | $multiple=true; |
||
56 | |||
57 | if($multiple) |
||
58 | { $this->Attributes()->set('size',$this->Attributes()->get('size',3)); |
||
59 | if(substr($this->Attributes()->get('name'), -2) !== '[]') |
||
60 | $this->Attributes()->set('name',$this->Attributes()->get('name').'[]'); |
||
61 | } |
||
62 | $html .= $this->Label()->RenderHtml(); |
||
63 | $this->Attributes()->Ignore(['value','selected','optgroup-attributes','option-attributes','placeholder']); |
||
64 | |||
65 | $html .= '<select'.$this->Attributes()->RenderHtml().'>'; |
||
66 | if(empty($this->Attributes()->get('value')[0]) and $this->Attributes()->has('placeholder')) |
||
67 | $html .= '<option value="" disabled selected>'.$this->Attributes()->get('placeholder').'</option>'; |
||
68 | |||
69 | foreach($this->options as $index=>$datas): |
||
70 | |||
71 | if(is_array($datas)) |
||
72 | $html .= $this->createOptgroup($index,$datas); |
||
73 | else |
||
74 | { |
||
75 | $optionAttr = null; |
||
76 | if($this->Attributes()->has('option-attributes')) |
||
77 | { |
||
78 | $oOption = new AttributesBuilder($this->Attributes()->get('option-attributes')); |
||
79 | $oOption->Ignore(['value','selected','placeholder']); |
||
80 | $oOption->set('type','option'); |
||
81 | $optionAttr .= $oOption->RenderHtml(); |
||
82 | } |
||
83 | $html .= '<option value="'.$index.'"'; |
||
84 | if(!$this->selected and in_array($index,$this->Attributes()->get('value'))) |
||
85 | { |
||
86 | $html .= ' selected="selected"'; |
||
87 | $this->selected = true; |
||
88 | } |
||
89 | if($optionAttr) $html .= ' '.$optionAttr ; |
||
90 | $html .= '>'; |
||
91 | $html .= $datas.'</option>'; |
||
92 | } |
||
93 | endforeach; |
||
94 | $html .= '</select>'; |
||
95 | return $html; |
||
96 | } |
||
145 | } |
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