File manager - Edit - /var/www/payraty/helpdesk/vendor/rector/rector/vendor/symplify/skipper/src/FileSystem/FnMatchPathNormalizer.php
Back
<?php declare (strict_types=1); namespace RectorPrefix202208\Symplify\Skipper\FileSystem; use RectorPrefix202208\Nette\Utils\Strings; /** * @see \Symplify\Skipper\Tests\FileSystem\FnMatchPathNormalizerTest */ final class FnMatchPathNormalizer { /** * @var string * @see https://regex101.com/r/ZB2dFV/2 */ private const ONLY_ENDS_WITH_ASTERISK_REGEX = '#^[^*](.*?)\\*$#'; /** * @var string * @see https://regex101.com/r/aVUDjM/2 */ private const ONLY_STARTS_WITH_ASTERISK_REGEX = '#^\\*(.*?)[^*]$#'; public function normalizeForFnmatch(string $path) : string { // ends with * if (Strings::match($path, self::ONLY_ENDS_WITH_ASTERISK_REGEX)) { return '*' . $path; } // starts with * if (Strings::match($path, self::ONLY_STARTS_WITH_ASTERISK_REGEX)) { return $path . '*'; } if (\strpos($path, '..') !== \false) { $path = \realpath($path); if ($path === \false) { return ''; } } return $path; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.30 | Generation time: 0 |
proxy
|
phpinfo
|
Settings