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