mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
fix: migrate action expression validation to separate rule class
This commit is contained in:
@@ -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:
|
||||
|
Reference in New Issue
Block a user