| Conditions | 6 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 19 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | 10 | public function pass(FuncCall $funcCall, Context $context) |
|
| 33 | { |
||
| 34 | 10 | $functionName = $this->resolveFunctionName($funcCall, $context); |
|
| 35 | 10 | if ($functionName && isset(self::$map[$functionName])) { |
|
| 36 | 1 | $pattern = $context->getExpressionCompiler()->compile($funcCall->args[0]); |
|
| 37 | 1 | if ($pattern->isString() && $pattern->isCorrectValue()) { |
|
| 38 | 1 | $guard = \RegexGuard\Factory::getGuard(); |
|
| 39 | 1 | if (!$guard->isRegexValid($pattern->getValue())) { |
|
| 40 | 1 | $context->notice( |
|
| 41 | 1 | 'regex.invalid', |
|
| 42 | 1 | sprintf( |
|
| 43 | 1 | 'Regular expression %s is not valid', |
|
| 44 | 1 | $pattern->getValue() |
|
| 45 | 1 | ), |
|
| 46 | 1 | $funcCall->args[0], |
|
| 47 | Check::CHECK_ALPHA |
||
| 48 | 1 | ); |
|
| 49 | 1 | } |
|
| 50 | 1 | } |
|
| 51 | 1 | } |
|
| 52 | 10 | } |
|
| 53 | } |
||
| 54 |