MinimumLengthValidator
class MinimumLengthValidator extends AbstractTranslatableValidator (View source)
Validate the length of a string.
\@package Concrete\Core\Validator\String
Constants
E_TOO_SHORT |
Too short |
Properties
protected array | $translatable_requirements | from AbstractTranslatableValidator | |
protected | $translatable_errors | from AbstractTranslatableValidator | |
protected int | $minimum_length |
Methods
Get an error string given a code and a passed value.
Check to see if $value a valid stand in for a translatable string.
Set the requirement string to a mixed value Closure format: function(TranslatableValidatorInterface $validator, int $code): string.
Set the error string to a string or to a closure Closure format: function(TranslatableValidatorInterface $validator, int $code, mixed $passed): string.
Get the validator requirements in the form of an array keyed by it's respective error code.
MinimumLengthValidator constructor.
Get the minimum length allowed.
Set the minimum length.
Details
protected string|mixed
getErrorString(int $code, mixed $value, mixed $default = null)
Get an error string given a code and a passed value.
protected bool
isTranslatableStringValueValid($value)
Check to see if $value a valid stand in for a translatable string.
setRequirementString(int $code, string|Closure $message)
Set the requirement string to a mixed value Closure format: function(TranslatableValidatorInterface $validator, int $code): string.
setErrorString(int $code, string|Closure $message)
Set the error string to a string or to a closure Closure format: function(TranslatableValidatorInterface $validator, int $code, mixed $passed): string.
where $passed
is whatever was passed to ValidatorInterface::isValid
string[]
getRequirementStrings()
Get the validator requirements in the form of an array keyed by it's respective error code.
Example: [ self::E_TOO_SHORT => 'Must be at least 10 characters' ]
__construct(int $minimum_length)
MinimumLengthValidator constructor.
int
getMinimumLength()
Get the minimum length allowed.
setMinimumLength(int $minimum_length)
Set the minimum length.
bool
isValid(mixed $mixed, ArrayAccess $error = null)
Is this mixed value valid.