/**
* @param Category[] $categories
*
* @return Category[] $categories Indexed by the category id
*/
private function filterValidCategories(array
$categories, ShopContextInterface
$context): array
{ $customerGroup =
$context->
getCurrentCustomerGroup();
return array_filter($categories,
function DCategory
$category) use ($customerGroup) { return !\
in_array($customerGroup->
getId(),
$category->
getBlockedCustomerGroupIds());
});
}}