protected function eliminateNestedPaths($arrPaths)
	{
		$arrPaths = array_filter($arrPaths);

		if (empty($arrPaths) || !\is_array($arrPaths))
		{
			return array();
		}

		$nested = array();

		foreach ($arrPaths as $path)
		{
			$nested[] = preg_grep('/^' . preg_quote($path, '/') . '\/.+/', $arrPaths);
		}

		if (!empty($nested))
		{
			$nested = array_merge(...$nested);
		}

		return array_values(array_diff($arrPaths, $nested));
	}
protected function eliminateNestedPaths($arrPaths)
	{
		$arrPaths = array_filter($arrPaths);

		if (empty($arrPaths) || !\is_array($arrPaths))
		{
			return array();
		}

		$nested = array();

		foreach ($arrPaths as $path)
		{
			$nested[] = preg_grep('/^' . preg_quote($path, '/') . '\/.+/', $arrPaths);
		}

		if (!empty($nested))
		{
			$nested = array_merge(...$nested);
		}

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

@param array $arrPaths The array of file paths

@return array The file paths array without the nested paths
Take an array of file paths and eliminate the nested ones