| Total Complexity | 6 |
| Total Lines | 89 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | class Filter |
||
| 16 | { |
||
| 17 | const INPUT_FILTER_FILTER = 'filter'; |
||
| 18 | const INPUT_FILTER_OPTIONS = 'options'; |
||
| 19 | const INPUT_FILTER_PROCESS = 'process'; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * filters arguments |
||
| 23 | * |
||
| 24 | * @var array |
||
| 25 | */ |
||
| 26 | private $filterArgs; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * input raw datas |
||
| 30 | * |
||
| 31 | * @var array |
||
| 32 | */ |
||
| 33 | private $data; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * prepared datas |
||
| 37 | * |
||
| 38 | * @var array |
||
| 39 | */ |
||
| 40 | private $prepared; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * processed datas results |
||
| 44 | * |
||
| 45 | * @var array |
||
| 46 | */ |
||
| 47 | private $result; |
||
| 48 | |||
| 49 | /** |
||
| 50 | * __construct |
||
| 51 | * |
||
| 52 | * @param array $data |
||
| 53 | * @param array $filterArgs |
||
| 54 | */ |
||
| 55 | 4 | public function __construct(array $data = [], array $filterArgs = []) |
|
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * process result filter |
||
| 65 | * |
||
| 66 | * @return Filter |
||
| 67 | */ |
||
| 68 | 2 | public function process(): Filter |
|
| 69 | { |
||
| 70 | 2 | $this->prepare(); |
|
| 71 | 2 | $this->result = \filter_var_array($this->data, $this->prepared); |
|
| 72 | 2 | return $this; |
|
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * toArray |
||
| 77 | * |
||
| 78 | * @return array |
||
| 79 | */ |
||
| 80 | 2 | public function toArray(): array |
|
| 83 | } |
||
| 84 | |||
| 85 | /** |
||
| 86 | * prepare datas |
||
| 87 | * |
||
| 88 | * @return Filter |
||
| 89 | */ |
||
| 90 | 1 | protected function prepare(): Filter |
|
| 104 | } |
||
| 105 | } |
||
| 106 |