public function add($name, $constraints)
    {
        if ( ! isset($this->constraints[$name])) {
            $this->constraints[$name] = [];
        }

        if (!is_array($constraints)) {
            $constraints = array($constraints);
        }

        foreach ($constraints as $constraint) {
            $this->constraints[$name][] = $constraint;
        }

        return $this;
    }
public function add($name, $constraints)
    {
        if ( ! isset($this->constraints[$name])) {
            $this->constraints[$name] = [];
        }

        if (!is_array($constraints)) {
            $constraints = array($constraints);
        }

        foreach ($constraints as $constraint) {
            $this->constraints[$name][] = $constraint;
        }

        return $this;
    }
public function add ( $ name , $ constraints ) { if ( ! isset ( $ this -> constraints [ $ name ] ) ) { $ this -> constraints [ $ name ] = [ ] ; } if ( ! is_array ( $ constraints ) ) { $ constraints = array ( $ constraints ) ; } foreach ( $ constraints as $ constraint ) { $ this -> constraints [ $ name ] [ ] = $ constraint ; } return $ this ; }
Add a constraint to the validator

@param $name
@param ConstraintInterface|ConstraintInterface[] $constraints
@return $this
Add a constraint to the validator