Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 3.0052 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | 1 | public function render() { |
|
17 | 1 | $html = ''; |
|
18 | 1 | $currentValue = $this->getValue(); |
|
19 | 1 | $attributes = $this->attributes; |
|
20 | 1 | $attributes['type'] = 'radio'; |
|
21 | |||
22 | 1 | foreach ($this->options as $value => $text) { |
|
23 | 1 | $attributes['value'] = $value; |
|
24 | 1 | if ($currentValue == $value) { |
|
25 | $attributes['checked'] = 'checked'; |
||
26 | } else { |
||
27 | 1 | unset($attributes['checked']); |
|
28 | } |
||
29 | |||
30 | 1 | $html .= '<label>' . static::tag('input', $attributes) . $text . '</label>'; |
|
31 | } |
||
32 | |||
33 | 1 | return $html; |
|
34 | } |
||
35 | } |