| Total Complexity | 6 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | class FilterByRoleNonStrictly implements NavigationFilterInterface |
||
| 17 | { |
||
| 18 | /** @var string[] */ |
||
| 19 | private $roles; |
||
| 20 | |||
| 21 | public function __construct(RolesProviderInterface $roleProvider) |
||
| 22 | { |
||
| 23 | $this->roles = $roleProvider->getRoles(); |
||
| 24 | } |
||
| 25 | |||
| 26 | public function filterItems(MutableContainerInterface $container): MutableContainerInterface |
||
| 27 | { |
||
| 28 | $filtered = clone $container; |
||
| 29 | $filtered->reset(); |
||
| 30 | |||
| 31 | array_map( |
||
| 32 | [$filtered, 'add'], |
||
| 33 | array_filter( |
||
| 34 | $container->getItems(), |
||
| 35 | [$this, 'filter'] |
||
| 36 | ) |
||
| 37 | ); |
||
| 38 | |||
| 39 | return $filtered; |
||
| 40 | } |
||
| 41 | |||
| 42 | private function filter(ItemInterface $item): bool |
||
| 56 | } |
||
| 57 | } |
||
| 58 |