ClosureValidator
class ClosureValidator implements ValidatorInterface (View source)
A generic validator cabable of describing itself and validating mixed values using closures.
Properties
| protected Closure | $validator_closure | The closure that handles validation.  | 
                |
| protected Closure | $requirements_closure | The closure that returns requirements.  | 
                
Methods
                    __construct(Closure $validator_closure, Closure $requirements_closure)
        
                                            
                
            ClosureValidator constructor.
                    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 handles validation.
        
                            
    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.
        
                            bool
    isValid(mixed $mixed, ArrayAccess $error = null)
        
    
    Is this mixed value valid.