DateTimePicker   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 10
c 0
b 0
f 0
dl 0
loc 23
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A add() 0 3 1
A getFilterAction() 0 3 1
1
<?php
2
3
namespace kalanis\kw_table\form_nette_lte\Fields;
4
5
6
use DateTime as dt;
7
use kalanis\kw_connect\core\Interfaces\IFilterFactory;
8
use kalanis\kw_table\form_nette\Fields;
9
10
11
/**
12
 * Class DateTimePicker
13
 * @package kalanis\kw_table\form_nette_lte\Controls
14
 */
15
class DateTimePicker extends Fields\AField
16
{
17
    protected ?dt $startTime;
18
    protected ?dt $endTime;
19
    protected ?string $searchFormat;
20
21
    public function __construct(?dt $startTime = null, ?dt $endTime = null, ?string $searchFormat = null, array $attributes = [])
22
    {
23
        $this->startTime = $startTime;
24
        $this->endTime = $endTime;
25
        $this->searchFormat = $searchFormat;
26
27
        parent::__construct($attributes);
28
    }
29
30
    public function getFilterAction(): string
31
    {
32
        return IFilterFactory::ACTION_RANGE;
33
    }
34
35
    public function add(): void
36
    {
37
        $this->form->addAdminLteDateTimeRange($this->alias, null, null, $this->searchFormat, $this->startTime, $this->endTime);
38
    }
39
}
40