Conditions | 1 |
Paths | 1 |
Total Lines | 18 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | 7 | public static function matches(string $wildcardText, string $text): bool |
|
14 | { |
||
15 | 7 | $regex = \preg_replace(self::REGEX_WILDCARD, self::REGEX_ANY_CHAR, $wildcardText); |
|
16 | |||
17 | 7 | $matches = []; |
|
18 | 7 | \preg_match_all( |
|
19 | 7 | self::REGEX_DELIMITER . \str_replace( |
|
20 | 7 | self::REGEX_DELIMITER, |
|
21 | 7 | '\\' . self::REGEX_DELIMITER, |
|
22 | $regex |
||
23 | 7 | ) . self::REGEX_DELIMITER, |
|
24 | $text, |
||
25 | $matches |
||
26 | ); |
||
27 | |||
28 | 7 | \array_shift($matches); |
|
29 | |||
30 | 7 | return \strtr($text, \array_fill_keys(Arr::flatten($matches), self::REGEX_ANY_CHAR)) === $regex; |
|
31 | } |
||
33 |