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