Adds a new custom message to current fieldname
@param string $rule
@param array $params
342009
private static function addMessage($rule, $params) {

		if(false === is_string($rule)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($rule)), E_USER_ERROR);
		}

		if(false === is_array($params)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($params)), E_USER_ERROR);
		}

		if(false === isset($params[0])) {
			return trigger_error(sprintf('Params passed to %s() are not well formed', __METHOD__), E_USER_ERROR);
		}

		foreach(static :: $fieldnames as $fieldname) {

			if(false === isset(static :: $messages[$fieldname][$rule])) {
				static :: $messages[$fieldname][$rule] = [];
			}

			static :: $messages[$fieldname][$rule] = $params[0];
		}
	}
942761
protected function addError($attribute, $rule, $parameters)
    {
        $message = $this->getMessage($attribute, $rule);

        $message = $this->doReplacements($message, $attribute, $rule, $parameters);

        $this->messages->add($attribute, $message);
    }
565308
public function addRule($field, $rule, $message, $options = array()) {
        if (empty($this->_fields[$field])) {
            throw new InvalidArgumentException(sprintf('Field %s does not exist', $field));
        }

        if (isset($this->_messages[$rule])) {
            $message = $message ?: $this->_messages[$rule];
        } else {
            $this->_messages[$rule] = $message;
        }

        $this->_rules[$field][$rule] = array(
            'message' => $message,
            'options' => (array) $options
        );

        return $this;
    }
761165
protected function buildRuleMessage($ruleName, $rule=null, $default=null, $input=null) {
		if($message = $this->getRuleMessage($ruleName)) {}
		elseif($message = $this->getRegistry()->getMessage($ruleName)) {}
		elseif($rule !== null && $message = $rule->getMessage()) {}
		elseif($default !== null && $message=$default) {}
		elseif($message = $this->getDefaultMessage()) {}
		else $message = ':attribute is not valid.';

		$params = [
			'attribute' => $this->getName(),
		];
		if(is_string($input) || is_numeric($input))
			$params['input'] = $input;
		if($rule instanceof Rule) {
			$params = array_merge($params, get_object_vars($rule));
			$rule->formatParameters($params);
		}

		if($this->getTranslator())
			$message = $this->getTranslator()->trans($message);

		return $this->format($message, $params);
	}
308072
public function updateUniques(array $rules = array(),
        array $customMessages = array(),
        array $options = array(),
        Closure $beforeSave = null,
        Closure $afterSave = null
    ) {
        $rules = $this->buildUniqueExclusionRules($rules);
        
        return $this->save($rules, $customMessages, $options, $beforeSave, $afterSave);
    }
327438
public function add($rules,$message,$field) {
        $this->rule = array_merge($this->rule,$rules);
        $this->message = array_merge($this->message, $message);
        $this->field = array_merge($this->field, $field);
        return $this;
    }
334273
public function addValidationMessage($rule, $message)
    {
        if (($pos = strpos($rule, ':')) !== false) {
            $rule = substr($rule, 0, $pos);
        }

        $this->validationMessages[$rule] = $message;

        return $this;
    }
66204
public function extend($rule, $extension, $message = null)
	{
		$this->extensions[$rule] = $extension;

		if ($message) $this->fallbackMessages[snake_case($rule)] = $message;
	}
128964
public function setRule($fieldName, Rule $rule)
    {
        $this->rules[$fieldName][get_class($rule)] = $rule;
        
        $rule->setValidator($this);
        
        return $this;
    }
513981
public function addRules(array $rules)
    {
        foreach ($rules as $character => $replacement) {
            $this->addRule($character, $replacement);
        }

        return $this;
    }
521200
public static function AppendRule ($rule_name, $rule) {
		$rule_list = static::GetValidateRuleList();
		$rule_list[$rule_name] = $rule;
		static::SetClassVar('_rule', $rule_list);
	}
814350
public function setRule($rule, $function, $message = '', $args = array())
    {
        if (!array_key_exists($rule, $this->rules)) {
            $this->rules[$rule] = TRUE;
            if (!array_key_exists($rule, $this->functions)) {
                if (!is_callable($function)) {
                    die('Invalid function for rule: ' . $rule);
                }
                $this->functions[$rule] = $function;
            }
            $this->arguments[$rule] = $args; // Specific arguments for rule

            $this->messages[$rule] = (empty($message)) ? $this->_getDefaultMessage($rule, $args) : $message;
        }
    }
1296184
public  function addRules($rules) {
        if ( is_array($rules) && !empty($rules) )
		    self::$tempRules = array_merge(self::$tempRules, $rules);
	}
778826
public function onForm(Rule $rule)
    {
        $this->onIndex();

        $name = $rule->exists ? 'rule-' . $rule->getValue() : 'rule-add';

        $this->breadcrumbs->register($name, function(Generator $breadcrumbs) use($rule) {
            $trans = 'antares/ban_management::messages.breadcrumbs';
            $name  = $rule->exists ? trans($trans . '.ip_edit', ['ip' => $rule->getValue()]) : trans($trans . '.ip_create');
            $breadcrumbs->parent(self::$name . '-rules');
            $breadcrumbs->push($name);
        });

        $this->shareOnView($name);
    }
1330252
protected function replaceNotIn($message, $attribute, $rule, $parameters)
    {
        return $this->replaceIn($message, $attribute, $rule, $parameters);
    }
412389
protected function replaceBefore($message, $attribute, $rule, $parameters)
    {
        if (! strtotime($parameters[0])) {
            return str_replace(':date', $this->getDisplayableAttribute($parameters[0]), $message);
        }

        return str_replace(':date', $this->getDisplayableValue($attribute, $parameters[0]), $message);
    }
200566
protected function getMessage( $attribute, $rule, array $parameters )
	{
		if( in_array( $rule, $this->sizeRules )) {
			return $this->getSizeMessage( $attribute, $rule, $parameters );
		}

		$lowerRule = $this->snakeCase( $rule );

		return $this->translator( $lowerRule, $rule, $attribute, $parameters );
	}