Total Complexity | 4 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
15 | final class UnsetArrayElementsExtension extends \Twig_Extension |
||
16 | { |
||
17 | /** |
||
18 | * @param array $elements |
||
19 | * @param array $keys |
||
20 | * |
||
21 | * @return array |
||
22 | */ |
||
23 | public function unsetElements(array $elements, array $keys): array |
||
24 | { |
||
25 | foreach ($keys as $key) { |
||
26 | if (!isset($elements[$key])) { |
||
27 | continue; |
||
28 | } |
||
29 | |||
30 | unset($elements[$key]); |
||
31 | } |
||
32 | |||
33 | return $elements; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | public function getFilters(): array |
||
43 | ]; |
||
44 | } |
||
46 |