Total Complexity | 9 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
7 | class DateRange extends Component |
||
8 | { |
||
9 | public $topclass; |
||
10 | public $inputclass; |
||
11 | public $title; |
||
12 | public $icon; |
||
13 | public $id; |
||
14 | public $init; |
||
15 | public $callback; |
||
16 | |||
17 | 2 | public function __construct( |
|
18 | $id, $topclass = null, $title = 'Filter Range', $icon = 'far fa-calendar-alt', |
||
19 | $init = 2, $callback = null, $inputclass = null |
||
20 | ) { |
||
21 | 2 | $this->id = $id; |
|
22 | 2 | $this->topclass = $topclass; |
|
23 | 2 | $this->inputclass = $inputclass; |
|
24 | 2 | $this->title = $title; |
|
25 | 2 | $this->icon = $icon; |
|
26 | 2 | $this->init = $init; |
|
27 | 2 | $this->callback = $callback; |
|
28 | 2 | } |
|
29 | |||
30 | 1 | public function initiator() |
|
31 | { |
||
32 | 1 | switch ($this->init) { |
|
33 | 1 | case 0: $s = 'startDate: moment(), endDate: moment()'; break; |
|
34 | 1 | case 1: $s = "startDate: moment().subtract(1, 'days'), endDate: moment().subtract(1, 'days')"; break; |
|
35 | 1 | case 2: $s = "startDate: moment().subtract(6, 'days'), endDate: moment()"; break; |
|
36 | 1 | case 3: $s = "startDate: moment().subtract(29, 'days'), endDate: moment()"; break; |
|
37 | 1 | case 4: $s = "startDate: moment().startOf('month'), endDate: moment().endOf('month')"; break; |
|
38 | 1 | case 5: $s = "startDate: moment().subtract(1, 'month').startOf('month'), endDate: moment().subtract(1, 'month').endOf('month')"; break; |
|
39 | } |
||
40 | |||
41 | 1 | return $s; |
|
|
|||
42 | } |
||
43 | |||
44 | 1 | public function render() |
|
47 | } |
||
48 | } |
||
49 |