Skip to content

Commit 550c6c4

Browse files
committed
Added property paramsTexts, and added methods setParameterText and getParametersTexts
1 parent 8e99f34 commit 550c6c4

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/Rule.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ abstract class Rule
2121
/** @var array */
2222
protected $params = [];
2323

24+
/** @var array */
25+
protected $paramsTexts = [];
26+
2427
/** @var array */
2528
protected $fillableParams = [];
2629

@@ -145,6 +148,28 @@ public function parameter(string $key)
145148
return isset($this->params[$key])? $this->params[$key] : null;
146149
}
147150

151+
/**
152+
* Set parameter text that can be displayed in error message using ':param_key'
153+
*
154+
* @param string $key
155+
* @param string $text
156+
* @return void
157+
*/
158+
public function setParameterText(string $key, string $text)
159+
{
160+
$this->paramsTexts[$key] = $text;
161+
}
162+
163+
/**
164+
* Get $paramsTexts
165+
*
166+
* @return array
167+
*/
168+
public function getParametersTexts(): array
169+
{
170+
return $this->paramsTexts;
171+
}
172+
148173
/**
149174
* Check whether this rule is implicit
150175
*

0 commit comments

Comments
 (0)