Prepares an array of paths.

@param   array  $paths  The paths to prepare
@return  array
186074
public function prep_paths(array $paths)
	{
		foreach ($paths as &$path)
		{
			$path = $this->prep_path($path);
		}
		return $paths;
	}
957775
private function prefixPaths (array $paths, string $prefix) : array
    {
        $result = [];

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

        return $result;
    }
472411
protected function sanitize($paths): Collection
    {
        return collect($paths)
            ->reject(function ($path) {
                return $path === '';
            })
            ->flatMap(function ($path) {
                return glob($path);
            })
            ->map(function ($path) {
                return realpath($path);
            })
            ->reject(function ($path) {
                return $path === false;
            });
    }
1362544
protected function prepareFiles(array $files)
    {
        $prepared = array();
        foreach ($files as $file) {

            $type = $file->getType();
            $path = $file->getRealPath();
            $relative_path = gplcart_file_relative($path);

            $item = array(
                'info' => $file,
                'type' => $type,
                'path' => $relative_path,
                'owner' => fileowner($path),
                'extension' => $file->getExtension(),
                'size' => gplcart_file_size($file->getSize()),
                'command' => $type === 'dir' ? 'list' : 'read',
                'commands' => $this->command->getAllowed($file),
                'permissions' => gplcart_file_perms($file->getPerms())
            );

            $prepared[$relative_path] = $item;
            $prepared[$relative_path]['icon'] = $this->renderIcon($item);
        }

        return $prepared;
    }
868828
private function inPaths($pathInfo, array $paths)
    {
        foreach ($paths as $path) {
            if (preg_match('#'.$path.'#', $pathInfo)) {
                return true;
            }
        }

        return false;
    }
828905
protected function streamlineFilePaths(array $paths): array
    {
        $paths = \array_map(function ($url) {
            if (!GeneralUtility::isValidUrl($url) && ':' !== $url[0]) {
                $url = GeneralUtility::locationHeaderUrl($url);
            }

            return $url;
        }, $paths);

        $paths = \array_filter($paths, function ($path) {
            return GeneralUtility::isOnCurrentHost($path) && ':' !== $path[0];
        });

        $paths = \array_map(function ($url) {
            return '/' . \ltrim(\str_replace(GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST'), '', $url), '/');
        }, $paths);

        return $paths;
    }
1122830
private function getPhpFilesMatchingPatternForCommandFromGivenPaths($paths)
    {
        return $this->getFlatArray(array_map(function ($path) {
            return $this->getPhpFilesMatchingPatternForCommandFromGivenPath($path);
        }, $paths));
    }
826347
public static function path(...$paths)
    {
        $protocol = '';
        $path = trim(implode(DIRECTORY_SEPARATOR, $paths));
        if (preg_match('@^([a-z0-9]+://|/)(.*)@i', $path, $m)) {
            $protocol = $m[1];
            $path = $m[2];
        }
        $path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);
        $parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
        $absolutes = [];
        foreach ($parts as $part) {
            if ('.' == $part) {
                continue;
            }
            if ('..' == $part) {
                array_pop($absolutes);
            } else {
                $absolutes[] = $part;
            }
        }
        $path = implode(DIRECTORY_SEPARATOR, $absolutes);
        if (DIRECTORY_SEPARATOR == '\\' && isset($protocol[4])) {
            $path = str_replace(DIRECTORY_SEPARATOR, '/', $path);
        }
        return $protocol . $path;
    }
235768
protected function preparePaths(string $folder, array $paths, string $fileNames = ''): string
    {
        foreach ($paths as $path) {
            if (dirname($path) != $folder) {
                return ''; // all source paths must be the same
            }
            if ($fileNames != '') {
                $fileNames .= ':';
            }
            $fileNames .= basename($path);
        }

        return $fileNames;
    }
437027
public function addPaths(array $paths)
    {
        $this->currentCollectorData = $this->filePathCollector->collect();

        foreach ($paths as $path) {
            $this->addPath($path);
        }
    }
1022643
protected function prependMountPoint(
        array $paths,
        /*# string */ $mountPoint
    )/*# : array */ {
        $res = [];
        foreach ($paths as $p) {
            $res[] = $this->mergePath($mountPoint, $p);
        }
        return $res;
    }
1368154
public function concat($paths)
    {
        if (is_array($paths))
            $paths = implode('/', $paths);
        return $this->fullPath() . '/' . $paths;
    }
246514
protected function retrieveAllFiles(array $paths)
    {
        $files = [];

        foreach ($paths as $path) {
            $newFiles = [];

            try {
                $newFiles = $this->retrieveFiles($path);
            } catch (FileSystemException $e) {
                continue;
            } finally {
                $files = array_merge($files, $newFiles);
            }
        }

        return $files;
    }
1180888
public function normalizePaths(array $paths)
    {
        $result = array();

        foreach ($paths as $key => $value) {
            // key is locale
            if (is_string($value)) {
                foreach ($this->getBrandingsWithLocale($key) as $branding) {
                    $result[$branding->getName()][$key] = $branding->prefixPath($key, $value);
                }
            }

            // key is branding
            if (is_array($value)) {
                foreach ($value as $locale => $path) {
                    $result[$key][$locale] = $this->getBranding($key)->prefixPath($locale, $path);
                }
            }
        }

        return $result;
    }
390810
public function setPaths($paths)
    {
        if (!($paths instanceof \SplPriorityQueue)) {
            $priority = new \SplPriorityQueue();

            foreach ((array) $paths as $i => $path) {
                $priority->insert($path, 100 - ($i * 10));
            }

            $paths = $priority;
        }

        $this->paths = $paths;

        return $this;
    }
1359761
public function sharedFilesAndDirs(array $paths = []): self
    {
        $this->sharedDirs = [];
        $this->sharedFiles = [];

        foreach ($paths as $path) {
            $this->validatePathIsRelativeToProject($path, __METHOD__);
            if (is_dir($this->localProjectDir.DIRECTORY_SEPARATOR.$path)) {
                $this->sharedDirs[] = rtrim($path, DIRECTORY_SEPARATOR);
            } else {
                $this->sharedFiles[] = $path;
            }
        }

        return $this;
    }
955596
private function prepareFileList($path)
    {
        return Finder::create()
            ->files()
            ->in($path)
            ->name('*.php')
            ->notPath('/Tests/')
            ->notPath('/tests/')
            ->ignoreUnreadableDirs()
            ->ignoreDotFiles(true)
            ->ignoreVCS(true);
    }