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