ClosureValidator
class ClosureValidator implements ValidatorInterface (View source)
Properties
protected Closure | $validator_closure | ||
protected Closure | $requirements_closure |
Methods
__construct(Closure $validator_closure, Closure $requirements_closure)
ClosureValidator constructor.
setValidatorClosure(Closure $validator_closure)
Set the closure that handls validation function(ClosureValidator $validator, mixed $passed, \Concrete\Core\Error $error = null): bool.
string[]
getRequirementStrings()
Get the validator requirements in the form of an array keyed by it's respective error code.
bool
Details
__construct(Closure $validator_closure, Closure $requirements_closure)
ClosureValidator constructor.
setValidatorClosure(Closure $validator_closure)
Set the closure that handls validation function(ClosureValidator $validator, mixed $passed, \Concrete\Core\Error $error = null): bool.
setRequirementsClosure(Closure $requirements_closure)
Set the closure that returns requirements.
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' ]
bool
isValid(mixed $mixed, ArrayAccess $error = null)
Is this mixed value valid.