Total Complexity | 4 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
16 | class FilterProcessor |
||
17 | { |
||
18 | /** |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $keys; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $replacement; |
||
27 | |||
28 | /** |
||
29 | * @param array $keys |
||
30 | * @param string $replacement |
||
31 | */ |
||
32 | 4 | public function __construct(array $keys = [], $replacement = null) |
|
36 | 4 | } |
|
37 | |||
38 | /** |
||
39 | * @param array $record |
||
40 | * |
||
41 | * @return array |
||
42 | */ |
||
43 | 3 | public function __invoke(array $record) |
|
44 | { |
||
45 | 3 | array_walk_recursive($record, [$this, 'filterValue']); |
|
46 | 3 | return $record; |
|
47 | } |
||
48 | |||
49 | /** |
||
50 | * @param mixed $value Value to filter as reference |
||
51 | * @param string $key |
||
52 | */ |
||
53 | 3 | protected function filterValue(&$value, $key) |
|
57 | } |
||
58 | 3 | } |
|
60 |