TrackManiaControl/libs/FML/ManiaCode/ShowMessage.php

83 lines
1.6 KiB
PHP
Raw Normal View History

2014-01-12 00:51:46 +01:00
<?php
namespace FML\ManiaCode;
/**
* ManiaCode Element showing a Message
*
2014-05-20 15:44:45 +02:00
* @author steeffeen <mail@steeffeen.com>
2017-03-25 18:40:15 +01:00
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
2014-05-18 19:45:50 +02:00
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
2014-01-12 00:51:46 +01:00
*/
2017-03-25 18:40:15 +01:00
class ShowMessage implements Element
{
/**
* @var string $message Message text
*/
protected $message = null;
/**
* Create a new ShowMessage Element
*
* @api
* @param string $message (optional) Message text
* @return static
*/
public static function create($message = null)
{
return new static($message);
}
/**
* Construct a new ShowMessage Element
*
* @api
* @param string $message (optional) Message text
*/
public function __construct($message = null)
{
if ($message) {
$this->setMessage($message);
}
}
/**
* Get the message text
*
* @api
* @return string
*/
public function getMessage()
{
return $this->message;
}
/**
* Set the message text
*
* @api
* @param string $message Message text
* @return static
*/
public function setMessage($message)
{
$this->message = (string)$message;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("show_message");
$messageElement = $domDocument->createElement("message", $this->message);
$domElement->appendChild($messageElement);
return $domElement;
}
2014-01-12 00:51:46 +01:00
}