closure.php
Go to the documentation of this file.
1 <?php
6 namespace depage\htmlform\validators;
7 
11 class closure extends validator
12 {
16  protected $validatorFunction;
17 
25  public function validate($value, $parameters = array())
26  {
27  return call_user_func($this->validatorFunction, $value, $parameters);
28  }
29 
36  public function setFunc($validatorFunction)
37  {
38  $this->validatorFunction = $validatorFunction;
39  }
40 }
customizable validator for input elements
Definition: closure.php:11
validate($value, $parameters=array())
validates value with a callable function/closure
Definition: closure.php:25
$validatorFunction
function to call
Definition: closure.php:16
parent validator class
Definition: validator.php:14
setFunc($validatorFunction)
sets the validators validator function
Definition: closure.php:36