Move ModelValidator::validateNonRoleEmail() to a new Validator class

We want to remove/refactor the whole ModelValidator class as part of the
Doctrine refactor.

This commit moves the method ModelValidator::validateNonRoleEmail() to a
new Validator class as the method is not used by the validator system of
the Paris models. ModelValidator::validateEmail() was also moved as it
is called by ModelValidator::validateNonRoleEmail().

[MAILPOET-4343]
This commit is contained in:
Rodrigo Primo
2023-05-05 16:37:23 -03:00
committed by Aschepikov
parent d760272678
commit 00d021109c
13 changed files with 123 additions and 67 deletions

View File

@@ -3,7 +3,7 @@
namespace MailPoet\Form\Block;
use MailPoet\Form\Util\FieldNameObfuscator;
use MailPoet\Models\ModelValidator;
use MailPoet\Services\Validator;
use MailPoet\WP\Functions as WPFunctions;
/**
@@ -32,8 +32,8 @@ class BlockRendererHelper {
if ($blockId === 'email') {
$rules['required'] = true;
$rules['minlength'] = ModelValidator::EMAIL_MIN_LENGTH;
$rules['maxlength'] = ModelValidator::EMAIL_MAX_LENGTH;
$rules['minlength'] = Validator::EMAIL_MIN_LENGTH;
$rules['maxlength'] = Validator::EMAIL_MAX_LENGTH;
$rules['type-message'] = __('This value should be a valid email.', 'mailpoet');
}