PhpSandbox\PHPSandbox::setValidator PHP Méthode

setValidator() public méthode

Validator callable must accept two parameters: a string of the normalized name of the checked element, and the PHPSandbox instance
public setValidator ( string $type, callable $callable ) : PHPSandbox
$type string String of $type name to set validator for
$callable callable Callable that validates the passed element
Résultat PHPSandbox Returns the PHPSandbox instance for fluent querying
    public function setValidator($type, $callable)
    {
        $type = strtolower($type);
        //normalize type
        if (array_key_exists($type, $this->validation)) {
            $this->validation[$type] = $callable;
        }
        return $this;
    }
PHPSandbox