diff --git a/src/Rule.php b/src/Rule.php index a724240..a2674ab 100644 --- a/src/Rule.php +++ b/src/Rule.php @@ -21,6 +21,9 @@ abstract class Rule /** @var array */ protected $params = []; + /** @var array */ + protected $paramsTexts = []; + /** @var array */ protected $fillableParams = []; @@ -145,6 +148,28 @@ public function parameter(string $key) return isset($this->params[$key])? $this->params[$key] : null; } + /** + * Set parameter text that can be displayed in error message using ':param_key' + * + * @param string $key + * @param string $text + * @return void + */ + public function setParameterText(string $key, string $text) + { + $this->paramsTexts[$key] = $text; + } + + /** + * Get $paramsTexts + * + * @return array + */ + public function getParametersTexts(): array + { + return $this->paramsTexts; + } + /** * Check whether this rule is implicit *