public function pass(FuncCall $funcCall, Context $context)
{
$functionName = $this->resolveFunctionName($funcCall, $context);
if ($functionName && isset(self::$map[$functionName])) {
$pattern = $context->getExpressionCompiler()->compile($funcCall->args[0]);
if ($pattern->isString() && $pattern->isCorrectValue()) {
$guard = \RegexGuard\Factory::getGuard();
if (!$guard->isRegexValid($pattern->getValue())) {
$context->notice('regex.invalid', sprintf('Regular expression %s is not valid', $pattern->getValue()), $funcCall->args[0], Check::CHECK_ALPHA);
}
}
}
}