MediaWiki REL1_39
ListParam.php
Go to the documentation of this file.
1<?php
2
3namespace Wikimedia\Message;
4
12class ListParam extends MessageParam {
13 private $listType;
14
22 public function __construct( $listType, array $elements ) {
23 $this->type = ParamType::LIST;
24 $this->listType = $listType;
25 $this->value = [];
26 foreach ( $elements as $element ) {
27 if ( $element instanceof MessageParam ) {
28 $this->value[] = $element;
29 } else {
30 $this->value[] = new ScalarParam( ParamType::TEXT, $element );
31 }
32 }
33 }
34
40 public function getListType() {
41 return $this->listType;
42 }
43
44 public function dump() {
45 $contents = '';
46 foreach ( $this->value as $element ) {
47 $contents .= $element->dump();
48 }
49 return "<{$this->type} listType=\"{$this->listType}\">$contents</{$this->type}>";
50 }
51}
Value object representing a message parameter that consists of a list of values.
Definition ListParam.php:12
__construct( $listType, array $elements)
Definition ListParam.php:22
getListType()
Get the type of the list.
Definition ListParam.php:40
dump()
Dump the object for testing/debugging.
Definition ListParam.php:44
Value object representing a message parameter that consists of a list of values.
const LIST
A list of values.
Definition ParamType.php:81
const TEXT
A simple text string or another MessageValue, not otherwise formatted.
Definition ParamType.php:13
Value object representing a message parameter holding a single value.