Remove from passed paths list all sub-paths.

@param string[] $paths

@return string[]
505626
private function excludeSubPaths(array $paths) : array
    {
        if (empty($paths)) {
            return $paths;
        }
        sort($paths);
        $uniquePaths = [$paths[0]];
        for ($i = 1, $count = count($paths); $i < $count; ++$i) {
            $lastUniquePath = end($uniquePaths);
            assert($lastUniquePath !== false);

            if (strpos($paths[$i], $lastUniquePath) === 0) {
                continue;
            }

            $uniquePaths[] = $paths[$i];
        }

        return $uniquePaths;
    }
695147
protected static function strip($sections): array
    {
        foreach ($sections as $section => $paths) {
            $sections[$section] = static::stripAbsolutePath($paths, $section == 'APP' ? null : $section);
        }

        return $sections;
    }
897268
public static function combinePath(...$paths)
    {
        //$paths=func_get_args();
        $value="";
        for($i=0;$i<count($paths);$i++){
            $path=$paths[$i];
            if($i>0){
                $value.="/";
                $path=ltrim($path,"/");
            }
            if($i<count($paths)-1){
                $path=rtrim($path,"/");
            }
            $value.=$path;
        }
        return $value;
    }
1045114
public function removePaths(array $paths, $clearCache = true, $group = '__DEFAULT__')
	{
		array_map([$this, 'removePath'], $paths, [[$clearCache, $group]]);
	}
531927
private function determineMostCommonBaseAppPath($paths)
    {
        $paths = array_values($paths);

        $options = [];
        $options[] = Path::getLongestCommonBasePath($paths);
        if (isset($paths[1])) {
            $options[] = Path::getLongestCommonBasePath([$paths[0], $paths[1]]);
        }
        if (isset($paths[2])) {
            $options[] = Path::getLongestCommonBasePath([$paths[1], $paths[2]]);
            $options[] = Path::getLongestCommonBasePath([$paths[0], $paths[2]]);
        }
        rsort($options);

        return reset($options);
    }
359628
public function getMigrationFiles($paths): array
    {
        return collect($paths)
            ->flatMap(
                function ($path) {
                    return collect(
                        (new Finder)->in([$path])
                            ->files()
                    )
                        ->map(
                            function (SplFileInfo $file) {
                                return $file->getPathname();
                            }
                        )
                        ->all();
                }
            )
            ->filter()
            ->sortBy(
                function ($file) {
                    return $this->getMigrationName($file);
                }
            )
            ->values()
            ->keyBy(
                function ($file) {
                    return $this->getMigrationName($file);
                }
            )
            ->all();
    }
1134532
protected function filterPaths(array $paths, $pattern, array $extensions=[])
    {
        if (!$this->isFilterPattern($pattern) && !$extensions) {
            return $paths;
        }
        return array_filter($paths, function ($path) use ($pattern, $extensions) {
            return $this->filterPath($path, $pattern, $extensions);
        });
    }
179977
def delete_paths(paths):
    
    for path in paths:
        if exists(path):
            if isfile(path):
                remove(path)
            else:
                rmtree(path)
1311988
public function setPaths(array $paths)
    {
        foreach ($paths as $value) {
            $this->ensureString(
                $value,
                'All the elements from array must be strings'
            );
        }

        $this->paths = $paths;

        return $this;
    }
957775
private function prefixPaths (array $paths, string $prefix) : array
    {
        $result = [];

        foreach ($paths as $namespace => $path)
        {
            $result[$namespace] = "{$prefix}/" . trim($path, "/");
        }

        return $result;
    }
1269390
protected function removeDots($path)
    {
        $isBeginning = true;

        // If not array, extract it.
        $isArray = is_array($path);

        $path = $isArray ? $path : $this->extract($path);

        // Search for dot files
        foreach ($path as $key => $row) {
            // Remove dot files
            if ($row === '.') {
                unset($path[$key]);
            }

            // Remove dots and go parent dir
            if ($row === '..' && !$isBeginning) {
                unset($path[$key]);
                unset($path[$key - 1]);
            }

            // Do not get parent if dots in the beginning
            if ($row !== '..' && $isBeginning) {
                $isBeginning = false;
            }
        }

        // Re index array
        $path = array_values($path);

        return $isArray ? $path : $this->compact($path);
    }
603016
public function setPaths($paths)
    {
        $paths = (array)$paths;
        //Append framework's view path
        $paths[] = realpath(__DIR__ . '/../../views');

        $this->paths = $paths;
        return $this;
    }
745837
protected static function combinePaths(string ...$paths): string
    {
        $last_key = \count($paths) - 1;
        array_walk($paths, function (&$val, $key) use ($last_key) {
            switch ($key) {
                case 0:
                    $val = rtrim($val, '/ ');
                    break;
                case $last_key:
                    $val = ltrim($val, '/ ');
                    break;
                default:
                    $val = trim($val, '/ ');
                    break;
            }
        });

        $first = array_shift($paths);
        $last = array_pop($paths);
        $paths = array_filter($paths);
        array_unshift($paths, $first);
        $paths[] = $last;

        return implode('/', $paths);
    }
1057283
def remove_directories(list_of_paths):
    
    found_dirs = set('/')
    for path in list_of_paths:
        dirs = path.strip().split('/')
        for i in range(2,len(dirs)):
            found_dirs.add( '/'.join(dirs[:i]) )

    paths = [ path for path in list_of_paths if
              (path.strip() not in found_dirs) and path.strip()[-1]!='/' ]
    return paths
1240219
public static function delete(array &$values, $path)
    {
        /** @noinspection ReferenceMismatchInspection */
        if (!static::isArray($values)) {
            // This is not an array!
            return false;
        }

        if (is_array($path)) {
            // The path has already been separated into segments
            $segments = $path;
        } else {
            $path = (string) $path;

            // Remove starting delimiters and spaces
            $path = ltrim($path, sprintf('%s ', static::PATH_DELIMITER));
            // Remove ending delimiters, spaces, and wildcards
            $path = rtrim($path, sprintf('%s %s', static::PATH_DELIMITER, static::PATH_WILDCARD));
            // Split the segments by delimiter
            $segments = explode(static::PATH_DELIMITER, $path);
        }

        while (count($segments) > 1) {
            $key = array_shift($segments);

            /** @noinspection ReferenceMismatchInspection */
            if (!array_key_exists($key, $values) || !is_array($values[$key])) {
                return false;
            }

            $values =& $values[$key];
        }

        unset($values[array_shift($segments)]);

        return true;
    }
1271720
public static function globAll(array $paths)
    {
        $result = [];

        foreach ($paths as $path) {
            $result = array_merge($result, static::glob($path));
        }

        return $result;
    }
1267706
public function acfLoadClean($paths)
    {
        $paths = array_unique($paths);

        foreach ($paths as $path) {
            foreach (@glob($path . '/*.json') as $file) {
                $json = json_decode(file_get_contents($file));

                if (!is_array($json)) {
                    continue;
                }

                $content = file($file);

                if (trim($content[0]) == '[') {
                    array_shift($content);
                    array_pop($content);
                }

                file_put_contents($file, $content);
            }
        }

        return $paths;
    }