SelectOption::renderInput()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace kalanis\kw_forms\Controls;
4
5
6
use kalanis\kw_forms\Interfaces\IOriginalValue;
7
8
9
/**
10
 * Class SelectOption
11
 * @package kalanis\kw_forms\Controls
12
 * Form element for selection - single option line
13
 */
14
class SelectOption extends AControl implements IOriginalValue
15
{
16
    use TSelected;
17
18
    protected string $templateLabel = '';
19
    protected string $templateInput = '<option value="%1$s"%2$s>%3$s</option>';
20
21 2
    public function getOriginalValue()
22
    {
23 2
        return $this->originalValue;
24
    }
25
26 4
    public function renderLabel($attributes = []): string
27
    {
28 4
        return '';
29
    }
30
31 4
    public function renderInput($attributes = null): string
32
    {
33 4
        return $this->wrapIt(sprintf($this->templateInput, $this->escaped(strval($this->originalValue)), $this->renderAttributes(), $this->escaped(strval($this->getLabel()))), $this->wrappersInput);
34
    }
35
36 4
    public function renderErrors(array $errors): string
37
    {
38 4
        return '';
39
    }
40
}
41