SelectOption   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 25
ccs 8
cts 8
cp 1
rs 10
c 1
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A renderErrors() 0 3 1
A renderLabel() 0 3 1
A renderInput() 0 3 1
A getOriginalValue() 0 3 1
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