| Total Complexity | 1 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | abstract class AbstractCombinedRegexp |
||
| 17 | { |
||
| 18 | public const REGEXP_DELIMITER = '/'; |
||
| 19 | public const QUOTE_REPLACER = '\\/'; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @return string[] Regular expressions to combine. |
||
| 23 | */ |
||
| 24 | abstract public function getPatterns(): array; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @return string Flags to apply to all regular expressions. |
||
| 28 | */ |
||
| 29 | abstract public function getFlags(): string; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @return string The compiled pattern. |
||
| 33 | */ |
||
| 34 | abstract public function getCompiledPattern(): string; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Returns `true` whether the given string matches any of the patterns, `false` - otherwise. |
||
| 38 | */ |
||
| 39 | abstract public function matches(string $string): bool; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Returns pattern that matches the given string. |
||
| 43 | * @throws Exception if the string does not match any of the patterns. |
||
| 44 | */ |
||
| 45 | abstract public function getMatchingPattern(string $string): string; |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Returns position of the pattern that matches the given string. |
||
| 49 | * @throws Exception if the string does not match any of the patterns. |
||
| 50 | */ |
||
| 51 | abstract public function getMatchingPatternPosition(string $string): int; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @throws Exception |
||
| 55 | * @return never-return |
||
|
|
|||
| 56 | */ |
||
| 57 | 3 | protected function throwFailedMatchException(string $string): void |
|
| 68 |