Upgrade to 3.2.5

This commit is contained in:
Bastian Allgeier
2019-09-24 11:00:59 +02:00
parent ff9b5b1861
commit 447a9dd266
234 changed files with 1990 additions and 1224 deletions

View File

@@ -107,6 +107,19 @@ class Validations
return true;
}
public static function pattern(Field $field, $value): bool
{
if ($field->isEmpty($value) === false && $field->pattern() !== null) {
if (V::match($value, '/' . $field->pattern() . '/i') === false) {
throw new InvalidArgumentException(
V::message('match')
);
}
}
return true;
}
public static function required(Field $field, $value): bool
{
if ($field->isRequired() === true && $field->save() === true && $field->isEmpty($value) === true) {