Total Complexity | 7 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class Filter{ |
||
6 | use CheckTrait; |
||
7 | |||
8 | protected array $messages = []; |
||
9 | protected array $treat = []; |
||
10 | |||
11 | public function getMessage(string $filter): string |
||
12 | { |
||
13 | return strval($this->messages[$filter]); |
||
14 | } |
||
15 | |||
16 | public function check(string $filter): bool |
||
17 | { |
||
18 | $this->check_method($filter); |
||
19 | $result = $this->$filter(); |
||
20 | return (is_bool($result)) ? $result : false; |
||
21 | } |
||
22 | |||
23 | protected function addMessage(string $filter, string $message): Filter |
||
24 | { |
||
25 | $this->messages[$filter] = $message; |
||
26 | return $this; |
||
27 | } |
||
28 | |||
29 | protected function addTreat(string $filter, string $treat): void |
||
32 | } |
||
33 | |||
34 | protected function treat(string $filter): void |
||
39 | } |
||
40 | } |
||
41 | |||
42 | } |