fix: migrate action expression validation to separate rule class

This commit is contained in:
Michael Thomas
2024-03-09 12:57:34 -05:00
parent 69ca88d9f8
commit c4bf2aae7d
7 changed files with 83 additions and 45 deletions

View File

@@ -254,27 +254,6 @@ class FireflyValidator extends Validator
return 1 === $count;
}
public function validateRuleActionExpression(string $attribute, string $value = null): bool
{
$value ??= '';
$expr = new ActionExpression($value);
return $expr->isValid();
}
public function replaceRuleActionExpression(string $message, string $attribute): string
{
$value = $this->getValue($attribute);
$expr = new ActionExpression($value);
$err = $expr->getValidationError();
if ($err == null) {
return $message;
}
return str_replace(":error", $err->getMessage(), $message);
}
public function validateRuleActionValue(string $attribute, string $value = null): bool
{
// first, get the index from this string: