protected function flattenMultiContextTree(array $return, array $contexts, array $actions = []) : array { $tree = []; foreach ($contexts as $c) { if (empty($tree)) { $tree = $return[$c]; continue; } $tree = $this->flattenContextTree($tree, $return[$c], $actions); } return $tree; }