Returns message by field and rule
@param string $field
@param string $rule
@return string
426271
public static function getMessage($field, $rule) {

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

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

		if(true === isset(static :: $messages[$field][$rule])) {
			return static :: $messages[$field][$rule];
		}
	}
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];
		}
	}
793102
protected function getSizeMessage($attribute, $rule)
    {
        $lowerRule = Str::camel($rule);

        // There are three different types of size validations. The attribute may be
        // either a number, file, or string so we will check a few things to know
        // which type of value it is and return the correct line for that type.
        $type = $this->getAttributeType($attribute);

        $key = "validation.{$lowerRule}.{$type}";

        return $this->config->get($key, $key);
    }
728669
public function getErrorTemplate(string $field, string $ruleSlug) : string
    {
        if (isset($this->fieldTemplates[$field][$ruleSlug])) {
            return $this->fieldTemplates[$field][$ruleSlug];
        }

        if (isset($this->globalTemplates[$ruleSlug])) {
            return $this->globalTemplates[$ruleSlug];
        }

        return '';
    }
1181986
public function getRule($ruleName)
    {
        if(!$this->hasRule($ruleName)) {
            throw new RuleNotFoundException(RuleNotFoundException::formatMessage($ruleName));
        }

        return $this->rules[$ruleName];
    }
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);
	}
1095484
public function getRequiredMessage($field)
    {
        if (!isset($this->_fields[$field])) {
            return null;
        }

        $defaultMessage = 'This field is required';
        if ($this->_useI18n) {
            $defaultMessage = __d('cake', 'This field is required');
        }

        return isset($this->_presenceMessages[$field])
            ? $this->_presenceMessages[$field]
            : $defaultMessage;
    }
165713
protected function _getRule($rule)
    {
        if ($rule instanceof FilterInterface) {
            return $rule;
        }

        $rule = (string) $rule;
        return $this->getPluginManager()->get($rule);
    }
477258
protected function getRuleName($rule)
    {
        /* Retire le caractère de négation de la fonction. */
        $function = $rule[ 0 ] == '!'
            ? substr($rule, 1)
            : $rule;

        /* Sépare le nom de la fonction si elle a des arguments. */
        if (($name = strstr($function, ':', true)) !== false) {
            return strtolower($name);
        }

        return strtolower($function);
    }
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;
    }
371876
private function addRule($rule, $field, $parameters, $closue = null, $message = null) {

		$this -> rules[] = (object) [

			'rule' 			=> $rule, 
			'field' 		=> $field, 
			'parameters'	=> $parameters,
			'closure'		=> $closue,
			'prefix' 		=> $this -> getPrefix(),
			'message'		=> $message,
			'required' 		=> true
		];
	}
1108574
protected function getInlineMessage($attribute, $rule)
    {
        $inlineEntry = $this->getFromLocalArray($attribute, Str::snake($rule));

        return is_array($inlineEntry) && in_array($rule, $this->sizeRules)
                    ? $inlineEntry[$this->getAttributeType($attribute)]
                    : $inlineEntry;
    }
38487
function message($rule, $error_message, $field = null) {
        $rule                                                 = explode(':', $rule);
        $rule                                                 = Arr::get($rule, 0);
        $this->messages[($field ? $field . '.' : '') . $rule] = $error_message;

        return $this;
    }
1106472
public function message($field, $message)
    {
        Arguments::define(Boa::string(), Boa::string())
            ->check($field, $message);

        $this->messages[$field] = $message;

        return $this;
    }
714998
public static function quoteField($field) {
        $trimmedField = trim($field);
        if ($trimmedField == '*') {
            return $trimmedField;
        }

        if (strpos($trimmedField, ' ') !== false) {
            return $trimmedField;
        }

        return strpos($trimmedField, '.') !== false ?
                $trimmedField : "`{$trimmedField}`";
    }
1340335
public function mapFieldRules(string $field, array $rules)
    {
        foreach ($rules as $rule) {
            //rule must be an array
            $rule = (array) $rule;

            //First element is the name of the rule
            $name = \array_shift($rule);

            //find a custom message, if any
            $message = null;
            if (isset($rule['message'])) {
                $message = $rule['message'];
                unset($rule['message']);
            }

            //Add the field and additional parameters to the rule
            $this->rule($name, $field, ...$rule);

            if (!empty($message)) {
                $this->message($message);
            }
        }
    }
1083008
public function rule($rule, $field)
    {
        $ruleMethod = 'is' . ucfirst($rule);
        if (!isset(static::$rules[$rule]) && !method_exists($this, $ruleMethod)) {
            throw new \InvalidArgumentException(Lang::get('_NOT_FOUND_', 'validate rule [' . $rule . ']'));
        }

        $params = array_slice(func_get_args(), 2);

        $this->dateBindRule[] = [
            'rule' => $rule,
            'field' => (array)$field,
            'params' => (array)$params
        ];
        return $this;
    }