PHP 8.2.31
Preview: FilesystemTweaker.php Size: 1.03 KB
//opt/cpanel/ea-wappspector/vendor/rector/rector/src/FileSystem/FilesystemTweaker.php

<?php

declare (strict_types=1);
namespace Rector\FileSystem;

final class FilesystemTweaker
{
    /**
     * This will turn paths like "src/Symfony/Component/*\/Tests" to existing directory paths
     *
     * @param string[] $paths
     *
     * @return string[]
     */
    public function resolveWithFnmatch(array $paths) : array
    {
        $absolutePathsFound = [];
        foreach ($paths as $path) {
            if (\strpos($path, '*') !== \false) {
                $foundPaths = $this->foundInGlob($path);
                $absolutePathsFound = \array_merge($absolutePathsFound, $foundPaths);
            } else {
                $absolutePathsFound[] = $path;
            }
        }
        return $absolutePathsFound;
    }
    /**
     * @return string[]
     */
    private function foundInGlob(string $path) : array
    {
        /** @var string[] $paths */
        $paths = (array) \glob($path);
        return \array_filter($paths, static function (string $path) : bool {
            return \file_exists($path);
        });
    }
}

Directory Contents

Dirs: 0 × Files: 6

Name Size Perms Modified Actions
958 B lrw-r--r-- 2024-11-08 13:59:10
Edit Download
3.51 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
6.10 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
1.03 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
1.56 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
655 B lrw-r--r-- 2024-11-08 13:59:10
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).