MediaWiki
REL1_37
ListParam.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Wikimedia\Message
;
4
12
class
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
}
Wikimedia\Message\ListParam
Value object representing a message parameter that consists of a list of values.
Definition
ListParam.php:12
Wikimedia\Message\ListParam\$listType
$listType
Definition
ListParam.php:13
Wikimedia\Message\ListParam\__construct
__construct( $listType, array $elements)
Definition
ListParam.php:22
Wikimedia\Message\ListParam\getListType
getListType()
Get the type of the list.
Definition
ListParam.php:40
Wikimedia\Message\ListParam\dump
dump()
Dump the object for testing/debugging.
Definition
ListParam.php:44
Wikimedia\Message\MessageParam
Value object representing a message parameter that consists of a list of values.
Definition
MessageParam.php:10
Wikimedia\Message\ParamType\LIST
const LIST
A list of values.
Definition
ParamType.php:69
Wikimedia\Message\ParamType\TEXT
const TEXT
A simple text string or another MessageValue, not otherwise formatted.
Definition
ParamType.php:13
Wikimedia\Message\ScalarParam
Value object representing a message parameter holding a single value.
Definition
ScalarParam.php:12
Wikimedia\Message
Definition
DataMessageValue.php:3
includes
libs
Message
ListParam.php
Generated on Fri Apr 5 2024 23:40:28 for MediaWiki by
1.9.8