Contao\Controller::eliminateNestedPaths PHP Method

eliminateNestedPaths() protected method

Take an array of file paths and eliminate the nested ones
protected eliminateNestedPaths ( array $arrPaths ) : array
$arrPaths array The array of file paths
return array The file paths array without the nested paths
    protected function eliminateNestedPaths($arrPaths)
    {
        $arrPaths = array_filter($arrPaths);
        if (!is_array($arrPaths) || empty($arrPaths)) {
            return array();
        }
        $nested = array();
        foreach ($arrPaths as $path) {
            $nested = array_merge($nested, preg_grep('/^' . preg_quote($path, '/') . '\\/.+/', $arrPaths));
        }
        return array_values(array_diff($arrPaths, $nested));
    }