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 |
||
15 | 1 | public function render() { |
|
16 | 1 | $html = ''; |
|
17 | 1 | $currentValue = $this->getValue(); |
|
18 | 1 | $attributes = $this->attributes; |
|
19 | 1 | $attributes['type'] = 'radio'; |
|
20 | |||
21 | 1 | foreach ($this->options as $value => $text) { |
|
22 | 1 | $attributes['value'] = $value; |
|
23 | 1 | if ($currentValue == $value) { |
|
24 | $attributes['checked'] = 'checked'; |
||
25 | } else { |
||
26 | 1 | unset($attributes['checked']); |
|
27 | } |
||
28 | |||
29 | 1 | $html .= '<label>' . static::tag('input', $attributes) . $text . '</label>'; |
|
30 | } |
||
31 | |||
32 | 1 | return $html; |
|
33 | } |
||
34 | } |