| Total Complexity | 6 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class FinderUtils |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Format a regex for PHP, with delimiters and flags. |
||
| 14 | * |
||
| 15 | * Using brackets delimiter, can't search bracket parameter. |
||
| 16 | * Fine for WebThumnailer. |
||
| 17 | * |
||
| 18 | * @param string $regex regex to format |
||
| 19 | * @param string $flags regex flags |
||
| 20 | * |
||
| 21 | * @return string Formatted regex. |
||
| 22 | */ |
||
| 23 | public static function buildRegex(string $regex, string $flags): string |
||
| 24 | { |
||
| 25 | return '{' . $regex . '}' . $flags; |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Make sure that given rules contain all mandatory fields. |
||
| 30 | * Support nested arrays. |
||
| 31 | * |
||
| 32 | * @param mixed[] $rules List of loaded rules. |
||
| 33 | * @param mixed[] $mandatoryKeys List of mandatory rules expected. |
||
| 34 | * |
||
| 35 | * @return bool if all mandatory rules are provided, false otherwise. |
||
| 36 | */ |
||
| 37 | public static function checkMandatoryRules(array $rules, array $mandatoryKeys): bool |
||
| 54 | } |
||
| 55 | } |
||
| 56 |