2014-01-12 00:51:46 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace FML\ManiaCode;
|
|
|
|
|
|
|
|
/**
|
2014-06-21 03:18:21 +02:00
|
|
|
* ManiaCode Element installing a map
|
2014-01-12 00:51:46 +01:00
|
|
|
*
|
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 InstallMap implements Element
|
|
|
|
{
|
2014-01-12 00:51:46 +01:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* @var string $name Map name
|
|
|
|
*/
|
|
|
|
protected $name = null;
|
2014-01-19 19:30:21 +01:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* @var string $url Map url
|
|
|
|
*/
|
|
|
|
protected $url = null;
|
2014-01-12 00:51:46 +01:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* Create a new InstallMap Element
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param string $name (optional) Map name
|
|
|
|
* @param string $url (optional) Map url
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public static function create($name = null, $url = null)
|
|
|
|
{
|
|
|
|
return new static($name, $url);
|
|
|
|
}
|
2014-01-12 00:51:46 +01:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* Construct a new InstallMap Element
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param string $name (optional) Map name
|
|
|
|
* @param string $url (optional) Map url
|
|
|
|
*/
|
|
|
|
public function __construct($name = null, $url = null)
|
|
|
|
{
|
|
|
|
if ($name) {
|
|
|
|
$this->setName($name);
|
|
|
|
}
|
|
|
|
if ($url) {
|
|
|
|
$this->setUrl($url);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the map name
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getName()
|
|
|
|
{
|
|
|
|
return $this->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the map name
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param string $name Map name
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public function setName($name)
|
|
|
|
{
|
|
|
|
$this->name = (string)$name;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the map url
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getUrl()
|
|
|
|
{
|
|
|
|
return $this->url;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the map url
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param string $url Map url
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public function setUrl($url)
|
|
|
|
{
|
|
|
|
$this->url = (string)$url;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see Element::render()
|
|
|
|
*/
|
|
|
|
public function render(\DOMDocument $domDocument)
|
|
|
|
{
|
|
|
|
$domElement = $domDocument->createElement("install_map");
|
|
|
|
|
|
|
|
$nameElement = $domDocument->createElement("name", $this->name);
|
|
|
|
$domElement->appendChild($nameElement);
|
|
|
|
|
|
|
|
$urlElement = $domDocument->createElement("url", $this->url);
|
|
|
|
$domElement->appendChild($urlElement);
|
|
|
|
|
|
|
|
return $domElement;
|
|
|
|
}
|
2014-01-12 00:51:46 +01:00
|
|
|
|
|
|
|
}
|