Skip to content

Commit

Permalink
Added property paramsTexts, and added methods setParameterText and ge…
Browse files Browse the repository at this point in the history
…tParametersTexts
  • Loading branch information
emsifa committed Nov 27, 2018
1 parent 8e99f34 commit 550c6c4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ abstract class Rule
/** @var array */
protected $params = [];

/** @var array */
protected $paramsTexts = [];

/** @var array */
protected $fillableParams = [];

Expand Down Expand Up @@ -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
*
Expand Down

0 comments on commit 550c6c4

Please sign in to comment.