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));
}