Passed
Push — master ( 92620c...1c7b90 )
by Petr
16:04 queued 07:51
created

DateTimeRangePicker::add()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace kalanis\kw_table_form_nette_lte\Fields;
4
5
6
use kalanis\kw_connect\core\Interfaces\IFilterFactory;
7
use kalanis\kw_table\form_nette\Fields;
8
9
10
\kalanis\kw_table\form_nette_lte\Controls\DateTimeRange::register();
11
12
13
/**
14
 * Class Listing\Connector\Form\Field\Nette\DateTimePicker
15
 * @package kalanis\kw_table\form_nette_lte\Controls
16
 */
17
class DateTimeRangePicker extends Fields\AField
18
{
19
    /** @var \DateTime|null */
20
    protected $startTime;
21
    /** @var \DateTime|null */
22
    protected $endTime;
23
    /** @var string|null */
24
    protected $searchFormat;
25
26
    public function __construct(?\DateTime $startTime = null, ?\DateTime $endTime = null, ?string $searchFormat = null, array $attributes = [])
27
    {
28
        $this->startTime = $startTime;
29
        $this->endTime = $endTime;
30
        $this->searchFormat = $searchFormat;
31
32
        parent::__construct($attributes);
33
    }
34
35
    public function getFilterAction(): string
36
    {
37
        return IFilterFactory::ACTION_RANGE;
38
    }
39
40
    public function add(): void
41
    {
42
        $this->form->addAdminLteDateTimeRange($this->alias, null, null, $this->searchFormat, $this->startTime, $this->endTime);
43
    }
44
}
45