type = ParamType::LIST; $this->listType = $listType; $this->value = []; foreach ( $elements as $element ) { if ( $element instanceof MessageParam ) { $this->value[] = $element; } elseif ( is_scalar( $element ) ) { $this->value[] = new TextParam( ParamType::TEXT, $element ); } else { throw new \InvalidArgumentException( 'ListParam elements must be MessageParam or scalar' ); } } } /** * Get the type of the list * * @return string One of the ListType constants */ public function getListType() { return $this->listType; } public function dump() { $contents = ''; foreach ( $this->value as $element ) { $contents .= $element->dump(); } return "<{$this->type} listType=\"{$this->listType}\">$contentstype}>"; } }