| 1 | <?php |
||
| 16 | trait PathSanityCheck |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * Check if the path looks like a regular expression. |
||
| 20 | * |
||
| 21 | * A sane path is non-empty and and contains no characters that are usually |
||
| 22 | * found in regular expressions: does not start with ^ or end with $ and |
||
| 23 | * does not contain the patterns .* or .+ or (). |
||
| 24 | * |
||
| 25 | * @param string $path |
||
| 26 | * |
||
| 27 | * @return bool Whether the path looks like it could be a regular expression |
||
| 28 | */ |
||
| 29 | 12 | private function looksLikeRegularExpression($path) |
|
| 44 | } |
||
| 45 |