Input   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A set() 0 6 1
1
<?php
2
3
namespace kalanis\kw_forms\Controls;
4
5
6
/**
7
 * Class Input
8
 * @package kalanis\kw_forms\Controls
9
 * Create simple form element
10
 * HTML5 input types (search, number, email, url, range, color, date, datetime, datetime-local, month, week, time, tel)
11
 * Default type="text". Set type example: $this->addAttributes(['type' => 'range'])
12
*/
13
class Input extends AControl
14
{
15
    protected string $templateInput = '<input value="%1$s"%2$s />%3$s';
16
17 3
    public function set(string $type, string $alias, ?string $value = null, string $label = ''): self
18
    {
19 3
        $this->setEntry($alias, $value, $label);
20 3
        $this->setAttribute('type', $type);
21 3
        $this->setAttribute('id', $this->getKey());
22 3
        return $this;
23
    }
24
}
25