| Conditions | 11 |
| Paths | 43 |
| Total Lines | 42 |
| Code Lines | 32 |
| 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 |
||
| 35 | public function RenderHtml() |
||
| 36 | { |
||
| 37 | $html = ''; |
||
| 38 | if($this->Types()->has($this->Attributes()->get('type'))) |
||
| 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 | if(sizeof($this->options)<2) |
||
| 45 | { |
||
| 46 | if($this->Attributes()->get('value')) |
||
| 47 | $this->Attributes()->set('checked','checked'); |
||
| 48 | $this->Attributes()->set('value','1'); |
||
| 49 | $this->hiddenInput = new Hidden($this->Label(),['value'=>'0']); |
||
| 50 | } |
||
| 51 | if($this->hiddenInput instanceof FormElementInterface) |
||
| 52 | return parent::RenderHtml().$this->hiddenInput->RenderHtml(); |
||
| 53 | if($this->Attributes()->has('value')) |
||
| 54 | { |
||
| 55 | if(!is_array($this->Attributes()->get('value'))) |
||
| 56 | $this->Attributes()->set('value',[$this->Attributes()->get('value')]); |
||
| 57 | } |
||
| 58 | else |
||
| 59 | $this->Attributes()->set('value',[]); |
||
| 60 | if(substr($this->Attributes()->get('name'), -2) !== '[]') |
||
| 61 | $this->Attributes()->set('name',$this->Attributes()->get('name').'[]'); |
||
| 62 | $count = 0; |
||
| 63 | $html .= $this->Label()->RenderHtml(); |
||
| 64 | $this->Attributes()->Ignore(['id', 'value', 'checked', 'required']); |
||
| 65 | foreach($this->options as $index => $details) |
||
| 66 | { |
||
| 67 | $html .= '<label for="'.$this->Attributes()->get('id').'-'.$count.'">'; |
||
| 68 | $html .= '<input id="'.$this->Attributes()->get('id').'-'.$count.'"'; |
||
| 69 | $html .= ' value="'.$index.'"'; |
||
| 70 | $html .= $this->Attributes()->RenderHtml(); |
||
| 71 | if(in_array($index , $this->Attributes()->get('value'))) $html .= ' checked="checked"'; |
||
| 72 | $html .= ' >'.$details.'</label>'; |
||
| 73 | ++$count; |
||
| 74 | } |
||
| 75 | } |
||
| 76 | return $html; |
||
| 77 | } |
||
| 79 |
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