DateRange   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
dl 0
loc 19
ccs 12
cts 12
cp 1
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A set() 0 13 1
1
<?php
2
3
namespace kalanis\kw_forms\Controls;
4
5
6
class DateRange extends AControl
7
{
8
    protected static int $uniqid = 0;
9
    protected string $templateLabel = '<label>%2$s</label>';
10
    protected string $templateInput = '%3$s';
11
12 2
    public function set(string $alias, ?string $value = null, string $label = ''): self
13
    {
14 2
        $this->setEntry($alias, $value, $label);
15 2
        $picker1 = new DatePicker();
16 2
        $picker1->set($alias . '[]');
17 2
        $picker1->setAttribute('id', sprintf('%s_%d', $alias, self::$uniqid));
18 2
        $picker2 = new DatePicker();
19 2
        $picker2->set($alias . '[]');
20 2
        $picker2->setAttribute('id', sprintf('%s_%d', $alias, self::$uniqid + 1));
21 2
        $this->setChildren([$picker1, $picker2]);
22 2
        self::$uniqid++;
23 2
        self::$uniqid++;
24 2
        return $this;
25
    }
26
}
27