| Current Path : /proc/thread-self/root/home/rtorresani/www/vendor/rector/rector/packages/Skipper/ |
| Current File : //proc/thread-self/root/home/rtorresani/www/vendor/rector/rector/packages/Skipper/Fnmatcher.php |
<?php
declare (strict_types=1);
namespace Rector\Skipper;
final class Fnmatcher
{
public function match(string $matchingPath, string $filePath) : bool
{
$normalizedMatchingPath = $this->normalizePath($matchingPath);
$normalizedFilePath = $this->normalizePath($filePath);
if (\fnmatch($normalizedMatchingPath, $normalizedFilePath)) {
return \true;
}
// in case of relative compare
return \fnmatch('*/' . $normalizedMatchingPath, $normalizedFilePath);
}
private function normalizePath(string $path) : string
{
return \str_replace('\\', '/', $path);
}
}