Merge "Add .pipeline/ with dev image variant"
[lhc/web/wiklou.git] / includes / libs / Message / ScalarParam.php
1 <?php
2
3 namespace Wikimedia\Message;
4
5 /**
6 * Value object representing a message parameter holding a single value.
7 *
8 * Message parameter classes are pure value objects and are safely newable.
9 */
10 class ScalarParam extends MessageParam {
11 /**
12 * Construct a text parameter
13 *
14 * @param string $type One of the ParamType constants.
15 * @param string|int|float|MessageValue $value
16 */
17 public function __construct( $type, $value ) {
18 $this->type = $type;
19 $this->value = $value;
20 }
21
22 public function dump() {
23 if ( $this->value instanceof MessageValue ) {
24 $contents = $this->value->dump();
25 } else {
26 $contents = htmlspecialchars( $this->value );
27 }
28 return "<{$this->type}>" . $contents . "</{$this->type}>";
29 }
30 }