RegexValidator
class RegexValidator extends AbstractTranslatableValidator (View source)
Constants
E_DOES_NOT_MATCH |
Passed string doesn't match. |
Properties
protected array | $translatable_requirements | from AbstractTranslatableValidator | |
protected array | $translatable_errors | from AbstractTranslatableValidator | |
protected string | $pattern | Regex pattern. |
Methods
Set the requirement string to a mixed value.
Set the error string to a string or to a closure.
Get the validator requirements in the form of an array keyed by it's respective error code.
Get an error string given a code and a passed value.
Check to see if $value a valid stand in for a translatable string.
RegexValidator constructor.
Get the regex pattern.
Set the regex pattern.
Details
setRequirementString(int $code, string|Closure $message)
Set the requirement string to a mixed value.
setErrorString(int $code, string|Closure $message)
Set the error string to a string or to a closure.
string[]
getRequirementStrings()
Get the validator requirements in the form of an array keyed by it's respective error code.
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(Closure|string|mixed $value)
Check to see if $value a valid stand in for a translatable string.
__construct(string $pattern)
RegexValidator constructor.
string
getPattern()
Get the regex pattern.
setPattern(string $pattern)
Set the regex pattern.
bool
isValid(mixed $mixed, ArrayAccess $error = null)
Is this mixed value valid.