MessageTemplate
API reference › Scaffold › MessageTemplate
Used by 2 types
Formats the sprintf template held by the backing value of a message enum case.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
getMessage() | Returns the message template formatted with $argument. | MessageTemplate |
plural() static | Returns the text of $one when $count is 1, and the text of $many otherwise. | MessageTemplate |
Method details
Section titled “Method details”getMessage()
Section titled “getMessage() ”public function getMessage(int|string ...$argument): stringReturns the message template formatted with $argument.
Parameters
| Parameter | Type | Description |
|---|---|---|
...$argument | int| | Values substituted into the template. |
Returns
string: Formatted message.
plural()
Section titled “plural() ”public static function plural(int $count, self $one, self $many): stringReturns the text of $one when $count is 1, and the text of $many otherwise.
Parameters
| Parameter | Type | Description |
|---|---|---|
$count | int | Number of items the fragment counts. |
$one | self | Fragment for a single item. |
$many | self | Fragment for zero or several items. |
Returns
string: Text of the fragment that agrees with $count.