LazyRecord\Schema\DeclareColumn::validator PHP Метод

validator() публичный Метод

public validator ( )
    public function validator()
    {
        $args = func_get_args();
        if (count($args) == 1 && is_callable($args[0])) {
            $this->attributes['validator'] = $args[0];
            return $this;
        } elseif (is_string($args[0])) {
            $arg = $args[0];
            if (is_a($arg, 'ValidationKit\\Validator', true)) {
                $this->attributes['validator'] = $args[0];
                if (isset($args[1])) {
                    $this->attributes['validatorArgs'] = $args[1];
                }
                return $this;
            }
            // guess class name
            $c = 'ValidationKit\\' . $arg;
            if (is_a($c, 'ValidationKit\\Validator', true)) {
                $this->attributes['validator'] = $c;
                if (isset($args[1])) {
                    $this->attributes['validatorArgs'] = $args[1];
                }
                return $this;
            }
            $c = 'ValidationKit\\' . $arg . 'Validator';
            if (is_a($c, 'ValidationKit\\Validator', true)) {
                $this->attributes['validator'] = $c;
                if (isset($args[1])) {
                    $this->attributes['validatorArgs'] = $args[1];
                }
                return $this;
            }
        }
        $this->attributes['validator'] = $args[0];
    }