EmptyControl   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setValue() 0 2 1
A getValue() 0 3 1
A renderInput() 0 3 1
1
<?php
2
3
namespace kalanis\kw_tree_controls\Controls;
4
5
6
use kalanis\kw_forms\Controls\Text;
7
use kalanis\kw_forms\Exceptions\RenderException;
8
9
10
/**
11
 * Class EmptyControl
12
 * @package kalanis\kw_tree_controls\Controls
13
 * Just when you need control entity without that control input
14
 */
15
class EmptyControl extends Text
16
{
17
    protected string $templateInput = '%3$s';
18
19 1
    public function getValue()
20
    {
21 1
        return null;
22
    }
23
24 1
    public function setValue(/** @scrutinizer ignore-unused */ $value): void
25
    {
26
        // intentionally nothing
27 1
    }
28
29
    /**
30
     * Return input entry in HTML
31
     * @param string|string[]|array|null $attributes
32
     * @throws RenderException
33
     * @return string
34
     */
35 3
    public function renderInput($attributes = null): string
36
    {
37 3
        return $this->wrapIt(sprintf($this->templateInput, '', '', $this->renderChildren()), $this->wrappersInput);
38
    }
39
}
40