DateRange::set()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 11
nc 1
nop 3
dl 0
loc 13
ccs 12
cts 12
cp 1
crap 1
rs 9.9
c 1
b 0
f 0
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