public function setRule($fieldName, Rule $rule)
    {
        $this->rules[$fieldName][get_class($rule)] = $rule;
        
        $rule->setValidator($this);
        
        return $this;
    }
public function setRule($fieldName, Rule $rule)
    {
        $this->rules[$fieldName][get_class($rule)] = $rule;
        
        $rule->setValidator($this);
        
        return $this;
    }
public function setRule ( $ fieldName , Rule $ rule ) { $ this -> rules [ $ fieldName ] [ get_class ( $ rule ) ] = $ rule ; $ rule -> setValidator ( $ this ) ; return $ this ; }
Sets the given rule for the form field with the given name.

@param string $fieldName
@param Rule $rule

@return $this
Sets the given rule for the form field with the given name .