MediaWiki
REL1_35
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)
Stable to call.
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:48
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 Sat Apr 6 2024 00:07:23 for MediaWiki by
1.9.8