5use InvalidArgumentException;
28 if ( self::$constants ===
null ) {
29 $rc =
new ReflectionClass( ParamType::class );
30 self::$constants = array_values( $rc->getConstants() );
67 if ( $param instanceof
Message ) {
70 if ( !is_array( $param ) ) {
74 if ( isset( $param[
'list'] ) && isset( $param[
'type'] ) ) {
75 $convertedElements = [];
76 foreach ( $param[
'list'] as $element ) {
79 return new ListParam( $param[
'type'], $convertedElements );
82 foreach ( self::getTypes() as
$type ) {
83 if (
$type !== ParamType::LIST && isset( $param[
$type] ) ) {
88 throw new InvalidArgumentException(
"Unrecognized Message param: " . json_encode( $param ) );
111 $convertedElements = [];
112 foreach ( $param->
getValue() as $element ) {
122 if ( $param->
getType() === ParamType::TEXT ) {
125 return [ $param->
getType() => $value ];
The Message class deals with fetching and processing of interface message into a variety of formats.
static listParam(array $list, $type='text')
getParams()
Returns the message parameters.
getKey()
Returns the message key.