Total Complexity | 5 |
Total Lines | 61 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | abstract class BaseFilter |
||
12 | { |
||
13 | use Configurable; |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $name = ''; |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $value; |
||
24 | |||
25 | /** |
||
26 | * @var mixed |
||
27 | */ |
||
28 | protected $data = []; |
||
29 | |||
30 | /** |
||
31 | * BaseFilter constructor. |
||
32 | * @param $config |
||
33 | */ |
||
34 | public function __construct($config = []) |
||
35 | { |
||
36 | $this->loadConfig($config); |
||
37 | $this->setValue(); |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Render filters template. |
||
42 | */ |
||
43 | abstract public function render(): string; |
||
44 | |||
45 | public function setValue(): void |
||
46 | { |
||
47 | $this->value = request()->input('filters.' . $this->getName(), $this->value); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @return mixed |
||
52 | */ |
||
53 | protected function getValue() |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * @return string |
||
60 | */ |
||
61 | protected function getName() |
||
62 | { |
||
63 | return $this->name; |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * @return mixed |
||
68 | */ |
||
69 | protected function getData() |
||
72 | } |
||
73 | } |
||
74 |