Updated to ManiaLink v3

This commit is contained in:
Jocy Wolff
2017-03-25 18:40:15 +01:00
parent 1010c1db6b
commit 120a0e2169
133 changed files with 16194 additions and 8949 deletions

View File

@ -6,55 +6,77 @@ namespace FML\ManiaCode;
* ManiaCode Element adding a buddy
*
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class AddBuddy extends Element {
/*
* Protected properties
*/
protected $tagName = 'add_buddy';
protected $login = null;
class AddBuddy implements Element
{
/**
* Create a new AddBuddy Element
*
* @param string $login (optional) Buddy login
* @return static
*/
public static function create($login = null) {
return new static($login);
}
/**
* @var string $login Buddy login
*/
protected $login = null;
/**
* Construct a new AddBuddy Element
*
* @param string $login (optional) Buddy login
*/
public function __construct($login = null) {
if ($login !== null) {
$this->setLogin($login);
}
}
/**
* Create a new AddBuddy Element
*
* @api
* @param string $login (optional) Buddy login
* @return static
*/
public static function create($login = null)
{
return new static($login);
}
/**
* Set the buddy login
*
* @param string $login Buddy login
* @return static
*/
public function setLogin($login) {
$this->login = (string)$login;
return $this;
}
/**
* Construct a new AddBuddy Element
*
* @api
* @param string $login (optional) Buddy login
*/
public function __construct($login = null)
{
if ($login) {
$this->setLogin($login);
}
}
/**
* Get the buddy login
*
* @api
* @return string
*/
public function getLogin()
{
return $this->login;
}
/**
* Set the buddy login
*
* @api
* @param string $login Buddy login
* @return static
*/
public function setLogin($login)
{
$this->login = (string)$login;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("add_buddy");
$loginElement = $domDocument->createElement("login", $this->login);
$domElement->appendChild($loginElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$loginElement = $domDocument->createElement('login', $this->login);
$xmlElement->appendChild($loginElement);
return $xmlElement;
}
}

View File

@ -6,78 +6,150 @@ namespace FML\ManiaCode;
* ManiaCode Element adding a server as favorite
*
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class AddFavorite extends Element {
/*
* Protected properties
*/
protected $tagName = 'add_favourite';
protected $login = null;
protected $serverIp = null;
protected $serverPort = null;
class AddFavorite implements Element
{
/**
* Create a new AddFavorite object
*
* @param string $login (optional) Server login
* @return static
*/
public static function create($login = null) {
return new static($login);
}
/**
* @var string $login Server login
*/
protected $login = null;
/**
* Construct a new AddFavorite object
*
* @param string $login (optional) Server login
*/
public function __construct($login = null) {
if ($login !== null) {
$this->setLogin($login);
}
}
/**
* @var string $ip Server ip
*/
protected $ip = null;
/**
* Set the server login
*
* @param string $login Server login
* @return static
*/
public function setLogin($login) {
$this->login = (string)$login;
$this->serverIp = null;
$this->serverPort = null;
return $this;
}
/**
* @var int $port Server port
*/
protected $port = null;
/**
* Set the server ip and port
*
* @param string $serverIp Server ip
* @param int $serverPort Server port
* @return static
*/
public function setIp($serverIp, $serverPort) {
$this->serverIp = (string)$serverIp;
$this->serverPort = (int)$serverPort;
$this->login = null;
return $this;
}
/**
* Create a new AddFavorite Element
*
* @api
* @param string $loginOrIp (optional) Server login or ip
* @param int $port (optional) Server port
* @return static
*/
public static function create($loginOrIp = null, $port = null)
{
return new static($loginOrIp, $port);
}
/**
* Construct a new AddFavorite Element
*
* @api
* @param string $loginOrIp (optional) Server login or ip
* @param int $port (optional) Server port
*/
public function __construct($loginOrIp = null, $port = null)
{
if ($port) {
$this->setIp($loginOrIp, $port);
} elseif ($loginOrIp) {
$this->setLogin($loginOrIp);
}
}
/**
* Get the server login
*
* @api
* @return string
*/
public function getLogin()
{
return $this->login;
}
/**
* Set the server login
*
* @api
* @param string $login Server login
* @return static
*/
public function setLogin($login)
{
$this->login = (string)$login;
$this->ip = null;
$this->port = null;
return $this;
}
/**
* Get the server ip
*
* @api
* @return string
*/
public function getIp()
{
return $this->ip;
}
/**
* Set the server ip and port
*
* @api
* @param string $ip Server ip
* @param int $port (optional) Server port
* @return static
*/
public function setIp($ip, $port = null)
{
$this->login = null;
$this->ip = (string)$ip;
if ($port) {
$this->setPort($port);
}
return $this;
}
/**
* Get the server port
*
* @api
* @return int
*/
public function getPort()
{
return $this->port;
}
/**
* Set the server port
*
* @param int $port Server port
* @return static
*/
public function setPort($port)
{
$this->port = (int)$port;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("add_favourite");
if ($this->login) {
$loginElement = $domDocument->createElement("login", $this->login);
$domElement->appendChild($loginElement);
} else {
$ipElement = $domDocument->createElement("ip", $this->ip . ":" . $this->port);
$domElement->appendChild($ipElement);
}
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
if ($this->serverIp === null) {
$loginElement = $domDocument->createElement('login', $this->login);
$xmlElement->appendChild($loginElement);
} else {
$ipElement = $domDocument->createElement('ip', $this->serverIp . ':' . $this->serverPort);
$xmlElement->appendChild($ipElement);
}
return $xmlElement;
}
}

View File

@ -6,23 +6,18 @@ namespace FML\ManiaCode;
* Base ManiaCode Element
*
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
abstract class Element {
/*
* Protected properties
*/
protected $tagName = 'element';
interface Element
{
/**
* Render the ManiaCode Element
*
* @param \DOMDocument $domDocument The DOMDocument for which the Element should be rendered
* @return \DOMElement
*/
public function render(\DOMDocument $domDocument);
/**
* Render the ManiaCode Element
*
* @param \DOMDocument $domDocument The DOMDocument for which the Element should be rendered
* @return \DOMElement
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = $domDocument->createElement($this->tagName);
return $xmlElement;
}
}

View File

@ -6,93 +6,151 @@ namespace FML\ManiaCode;
* ManiaCode Element downloading a skin
*
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class GetSkin extends Element {
/*
* Protected properties
*/
protected $tagName = 'get_skin';
protected $name = null;
protected $file = null;
protected $url = null;
class GetSkin implements Element
{
/**
* Create a new GetSkin object
*
* @param string $name (optional) Skin name
* @param string $file (optional) Skin file
* @param string $url (optional) Skin url
* @return static
*/
public static function create($name = null, $file = null, $url = null) {
return new static($name, $file, $url);
}
/**
* @var string $name Skin name
*/
protected $name = null;
/**
* Construct a new GetSkin object
*
* @param string $name (optional) Skin name
* @param string $file (optional) Skin file
* @param string $url (optional) Skin url
*/
public function __construct($name = null, $file = null, $url = null) {
if ($name !== null) {
$this->setName($name);
}
if ($file !== null) {
$this->setFile($file);
}
if ($url !== null) {
$this->setUrl($url);
}
}
/**
* @var string $file Skin file
*/
protected $file = null;
/**
* Set the name of the skin
*
* @param string $name Skin name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* @var string $url Skin url
*/
protected $url = null;
/**
* Set the file of the skin
*
* @param string $file Skin file
* @return static
*/
public function setFile($file) {
$this->file = (string)$file;
return $this;
}
/**
* Create a new GetSkin Element
*
* @api
* @param string $name (optional) Skin name
* @param string $file (optional) Skin file
* @param string $url (optional) Skin url
* @return static
*/
public static function create($name = null, $file = null, $url = null)
{
return new static($name, $file, $url);
}
/**
* Set the url of the skin
*
* @param string $url Skin url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* Construct a new GetSkin Element
*
* @api
* @param string $name (optional) Skin name
* @param string $file (optional) Skin file
* @param string $url (optional) Skin url
*/
public function __construct($name = null, $file = null, $url = null)
{
if ($name) {
$this->setName($name);
}
if ($file) {
$this->setFile($file);
}
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the skin name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the skin name
*
* @api
* @param string $name Skin name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the skin file
*
* @api
* @return string
*/
public function getFile()
{
return $this->file;
}
/**
* Set the skin file
*
* @api
* @param string $file Skin file
* @return static
*/
public function setFile($file)
{
$this->file = (string)$file;
return $this;
}
/**
* Get the skin url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the skin url
*
* @api
* @param string $url Skin url
* @return static
*/
public function setUrl($url)
{
$this->url = (string)$url;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("get_skin");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$fileElement = $domDocument->createElement("file", $this->file);
$domElement->appendChild($fileElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$fileElement = $domDocument->createElement('file', $this->file);
$xmlElement->appendChild($fileElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
}

View File

@ -6,55 +6,77 @@ namespace FML\ManiaCode;
* ManiaCode Element for going to a link
*
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class Go_To extends Element {
/*
* Protected properties
*/
protected $tagName = 'goto';
protected $link = null;
class Go_To implements Element
{
/**
* Create a new Go_To object
*
* @param string $link (optional) Goto link
* @return static
*/
public static function create($link = null) {
return new static($link);
}
/**
* @var string $link Link
*/
protected $link = null;
/**
* Construct a new Go_To object
*
* @param string $link (optional) Goto link
*/
public function __construct($link = null) {
if ($link !== null) {
$this->setLink($link);
}
}
/**
* Create a new Go_To Element
*
* @api
* @param string $link (optional) Link
* @return static
*/
public static function create($link = null)
{
return new static($link);
}
/**
* Set link
*
* @param string $link Goto link
* @return static
*/
public function setLink($link) {
$this->link = (string)$link;
return $this;
}
/**
* Construct a new Go_To Element
*
* @api
* @param string $link (optional) Link
*/
public function __construct($link = null)
{
if ($link) {
$this->setLink($link);
}
}
/**
* Get the link
*
* @api
* @return string
*/
public function getLink()
{
return $this->link;
}
/**
* Set the link
*
* @api
* @param string $link Link
* @return static
*/
public function setLink($link)
{
$this->link = (string)$link;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("goto");
$linkElement = $domDocument->createElement("link", $this->link);
$domElement->appendChild($linkElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$linkElement = $domDocument->createElement('link', $this->link);
$xmlElement->appendChild($linkElement);
return $xmlElement;
}
}

View File

@ -6,92 +6,151 @@ namespace FML\ManiaCode;
* ManiaCode Element installing a macroblock
*
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class InstallMacroblock extends Element {
/*
* Protected properties
*/
protected $tagName = 'install_macroblock';
protected $name = null;
protected $file = null;
protected $url = null;
class InstallMacroblock implements Element
{
/**
* Create a new InstallMacroblock object
*
* @param string $name (optional) Macroblock name
* @param string $url (optional) Macroblock url
* @return static
*/
public static function create($name = null, $url = null) {
return new static($name, $url);
}
/**
* @var string $name Macroblock name
*/
protected $name = null;
/**
* Construct a new InstallMacroblock object
*
* @param string $name (optional) Macroblock name
* @param string $file (optional) Macroblock file
* @param string $url (optional) Macroblock url
*/
public function __construct($name = null, $file = null, $url = null) {
if ($name !== null) {
$this->setName($name);
}
if ($file !== null) {
$this->setFile($file);
}
if ($url !== null) {
$this->setUrl($url);
}
}
/**
* @var string $file Macroblock file
*/
protected $file = null;
/**
* Set the name of the macroblock
*
* @param string $name Macroblock name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* @var string $url Macroblock url
*/
protected $url = null;
/**
* Set the file of the macroblock
*
* @param string $file Macroblock file
* @return static
*/
public function setFile($file) {
$this->file = (string)$file;
return $this;
}
/**
* Create a new InstallMacroblock Element
*
* @api
* @param string $name (optional) Macroblock name
* @param string $file (optional) Macroblock file
* @param string $url (optional) Macroblock url
* @return static
*/
public static function create($name = null, $file = null, $url = null)
{
return new static($name, $file, $url);
}
/**
* Set the url of the macroblock
*
* @param string $url Macroblock url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* Construct a new InstallMacroblock Element
*
* @api
* @param string $name (optional) Macroblock name
* @param string $file (optional) Macroblock file
* @param string $url (optional) Macroblock url
*/
public function __construct($name = null, $file = null, $url = null)
{
if ($name) {
$this->setName($name);
}
if ($file) {
$this->setFile($file);
}
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the macroblock name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the macroblock name
*
* @api
* @param string $name Macroblock name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the macroblock file
*
* @api
* @return string
*/
public function getFile()
{
return $this->file;
}
/**
* Set the macroblock file
*
* @api
* @param string $file Macroblock file
* @return static
*/
public function setFile($file)
{
$this->file = (string)$file;
return $this;
}
/**
* Get the macroblock url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the macroblock url
*
* @api
* @param string $url Macroblock 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_macroblock");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$fileElement = $domDocument->createElement("file", $this->file);
$domElement->appendChild($fileElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$fileElement = $domDocument->createElement('file', $this->file);
$xmlElement->appendChild($fileElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
}

View File

@ -6,74 +6,114 @@ namespace FML\ManiaCode;
* ManiaCode Element installing a map
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class InstallMap extends Element {
/*
* Protected properties
*/
protected $tagName = 'install_map';
protected $name = null;
protected $url = null;
class InstallMap implements Element
{
/**
* Create a new InstallMap object
*
* @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);
}
/**
* @var string $name Map name
*/
protected $name = null;
/**
* Construct a new InstallMap object
*
* @param string $name (optional) Map name
* @param string $url (optional) Map url
*/
public function __construct($name = null, $url = null) {
if ($name !== null) {
$this->setName($name);
}
if ($url !== null) {
$this->setUrl($url);
}
}
/**
* @var string $url Map url
*/
protected $url = null;
/**
* Set the name of the map
*
* @param string $name Map name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* 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);
}
/**
* Set the url of the map
*
* @param string $url Map url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* 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;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
}

View File

@ -6,93 +6,151 @@ namespace FML\ManiaCode;
* ManiaCode Element installing a title pack
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class InstallPack extends Element {
/*
* Protected properties
*/
protected $tagName = 'install_pack';
protected $name = null;
protected $file = null;
protected $url = null;
class InstallPack implements Element
{
/**
* Create a new InstallPack object
*
* @param string $name (optional) Pack name
* @param string $file (optional) Pack file
* @param string $url (optional) Pack url
* @return static
*/
public static function create($name = null, $file = null, $url = null) {
return new static($name, $file, $url);
}
/**
* @var string $name Pack name
*/
protected $name = null;
/**
* Construct a new InstallPack object
*
* @param string $name (optional) Pack name
* @param string $file (optional) Pack file
* @param string $url (optional) Pack url
*/
public function __construct($name = null, $file = null, $url = null) {
if ($name !== null) {
$this->setName($name);
}
if ($file !== null) {
$this->setFile($file);
}
if ($url !== null) {
$this->setUrl($url);
}
}
/**
* @var string $file Pack file
*/
protected $file = null;
/**
* Set the name of the pack
*
* @param string $name Pack name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* @var string $url Pack url
*/
protected $url = null;
/**
* Set the file of the pack
*
* @param string $file Pack file
* @return static
*/
public function setFile($file) {
$this->file = (string)$file;
return $this;
}
/**
* Create a new InstallPack Element
*
* @api
* @param string $name (optional) Pack name
* @param string $file (optional) Pack file
* @param string $url (optional) Pack url
* @return static
*/
public static function create($name = null, $file = null, $url = null)
{
return new static($name, $file, $url);
}
/**
* Set the url of the pack
*
* @param string $url Pack url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* Construct a new InstallPack Element
*
* @api
* @param string $name (optional) Pack name
* @param string $file (optional) Pack file
* @param string $url (optional) Pack url
*/
public function __construct($name = null, $file = null, $url = null)
{
if ($name) {
$this->setName($name);
}
if ($file) {
$this->setFile($file);
}
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the pack name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the pack name
*
* @api
* @param string $name Pack name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the pack file
*
* @api
* @return string
*/
public function getFile()
{
return $this->file;
}
/**
* Set the pack file
*
* @api
* @param string $file Pack file
* @return static
*/
public function setFile($file)
{
$this->file = (string)$file;
return $this;
}
/**
* Get the pack url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the pack url
*
* @api
* @param string $url Pack 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_pack");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$fileElement = $domDocument->createElement("file", $this->file);
$domElement->appendChild($fileElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$fileElement = $domDocument->createElement('file', $this->file);
$xmlElement->appendChild($fileElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
}

View File

@ -6,74 +6,114 @@ namespace FML\ManiaCode;
* ManiaCode Element installing a replay
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class InstallReplay extends Element {
/*
* Protected properties
*/
protected $tagName = 'install_replay';
protected $name = null;
protected $url = null;
class InstallReplay implements Element
{
/**
* Create a new InstallReplay object
*
* @param string $name (optional) Replay name
* @param string $url (optional) Replay url
* @return static
*/
public static function create($name = null, $url = null) {
return new static($name, $url);
}
/**
* @var string $name Replay name
*/
protected $name = null;
/**
* Construct a new InstallReplay object
*
* @param string $name (optional) Replay name
* @param string $url (optional) Replay url
*/
public function __construct($name = null, $url = null) {
if ($name!== null) {
$this->setName($name);
}
if ($url!== null) {
$this->setUrl($url);
}
}
/**
* @var string $url Replay url
*/
protected $url = null;
/**
* Set the name of the replay
*
* @param string $name Replay name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* Create a new InstallReplay Element
*
* @api
* @param string $name (optional) Replay name
* @param string $url (optional) Replay url
* @return static
*/
public static function create($name = null, $url = null)
{
return new static($name, $url);
}
/**
* Set the url of the replay
*
* @param string $url Replay url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* Construct a new InstallReplay Element
*
* @api
* @param string $name (optional) Replay name
* @param string $url (optional) Replay url
*/
public function __construct($name = null, $url = null)
{
if ($name) {
$this->setName($name);
}
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the replay name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the replay name
*
* @api
* @param string $name Replay name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the replay url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the replay url
*
* @api
* @param string $url Replay 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_replay");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
}

View File

@ -6,93 +6,151 @@ namespace FML\ManiaCode;
* ManiaCode Element installing a script
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class InstallScript extends Element {
/*
* Protected properties
*/
protected $tagName = 'install_script';
protected $name = null;
protected $file = null;
protected $url = null;
class InstallScript implements Element
{
/**
* Create a new InstallScript object
*
* @param string $name (optional) Script name
* @param string $file (optional) Script file
* @param string $url (optional) Script url
* @return static
*/
public static function create($name = null, $file = null, $url = null) {
return new static($name, $file, $url);
}
/**
* @var string $name Script name
*/
protected $name = null;
/**
* Construct a new InstallScript object
*
* @param string $name (optional) Script name
* @param string $file (optional) Script file
* @param string $url (optional) Script url
*/
public function __construct($name = null, $file = null, $url = null) {
if ($name !== null) {
$this->setName($name);
}
if ($file !== null) {
$this->setFile($file);
}
if ($url !== null) {
$this->setUrl($url);
}
}
/**
* @var string $file Script file
*/
protected $file = null;
/**
* Set the name of the script
*
* @param string $name Script name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* @var string $url Script url
*/
protected $url = null;
/**
* Set the file of the script
*
* @param string $file Script file
* @return static
*/
public function setFile($file) {
$this->file = (string)$file;
return $this;
}
/**
* Create a new InstallScript Element
*
* @api
* @param string $name (optional) Script name
* @param string $file (optional) Script file
* @param string $url (optional) Script url
* @return static
*/
public static function create($name = null, $file = null, $url = null)
{
return new static($name, $file, $url);
}
/**
* Set the url of the script
*
* @param string $url Script url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* Construct a new InstallScript Element
*
* @api
* @param string $name (optional) Script name
* @param string $file (optional) Script file
* @param string $url (optional) Script url
*/
public function __construct($name = null, $file = null, $url = null)
{
if ($name) {
$this->setName($name);
}
if ($file) {
$this->setFile($file);
}
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the script name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the script name
*
* @api
* @param string $name Script name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the script file
*
* @api
* @return string
*/
public function getFile()
{
return $this->file;
}
/**
* Set the script file
*
* @api
* @param string $file Script file
* @return static
*/
public function setFile($file)
{
$this->file = (string)$file;
return $this;
}
/**
* Get the script url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the script url
*
* @api
* @param string $url Script 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_script");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$fileElement = $domDocument->createElement("file", $this->file);
$domElement->appendChild($fileElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$fileElement = $domDocument->createElement('file', $this->file);
$xmlElement->appendChild($fileElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
}

View File

@ -6,93 +6,151 @@ namespace FML\ManiaCode;
* ManiaCode Element installing a skin
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class InstallSkin extends Element {
/*
* Protected properties
*/
protected $tagName = 'install_skin';
protected $name = null;
protected $file = null;
protected $url = null;
class InstallSkin implements Element
{
/**
* Create a new InstallSkin object
*
* @param string $name (optional) Skin name
* @param string $file (optional) Skin file
* @param string $url (optional) Skin url
* @return static
*/
public static function create($name = null, $file = null, $url = null) {
return new static($name, $file, $url);
}
/**
* @var string $name Skin name
*/
protected $name = null;
/**
* Construct a new InstallSkin object
*
* @param string $name (optional) Skin name
* @param string $file (optional) Skin file
* @param string $url (optional) Skin url
*/
public function __construct($name = null, $file = null, $url = null) {
if ($name !== null) {
$this->setName($name);
}
if ($file !== null) {
$this->setFile($file);
}
if ($url !== null) {
$this->setUrl($url);
}
}
/**
* @var string $file Skin file
*/
protected $file = null;
/**
* Set the name of the skin
*
* @param string $name Skin name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* @var string $url Skin url
*/
protected $url = null;
/**
* Set the file of the skin
*
* @param string $file Skin file
* @return static
*/
public function setFile($file) {
$this->file = (string)$file;
return $this;
}
/**
* Create a new InstallSkin Element
*
* @api
* @param string $name (optional) Skin name
* @param string $file (optional) Skin file
* @param string $url (optional) Skin url
* @return static
*/
public static function create($name = null, $file = null, $url = null)
{
return new static($name, $file, $url);
}
/**
* Set the url of the skin
*
* @param string $url Skin url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* Construct a new InstallSkin Element
*
* @api
* @param string $name (optional) Skin name
* @param string $file (optional) Skin file
* @param string $url (optional) Skin url
*/
public function __construct($name = null, $file = null, $url = null)
{
if ($name) {
$this->setName($name);
}
if ($file) {
$this->setFile($file);
}
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the skin name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the skin name
*
* @api
* @param string $name Skin name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the skin file
*
* @api
* @return string
*/
public function getFile()
{
return $this->file;
}
/**
* Set the skin file
*
* @api
* @param string $file Skin file
* @return static
*/
public function setFile($file)
{
$this->file = (string)$file;
return $this;
}
/**
* Get the skin url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the skin url
*
* @api
* @param string $url Skin 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_skin");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$fileElement = $domDocument->createElement("file", $this->file);
$domElement->appendChild($fileElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$fileElement = $domDocument->createElement('file', $this->file);
$xmlElement->appendChild($fileElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
}

View File

@ -6,78 +6,150 @@ namespace FML\ManiaCode;
* ManiaCode Element for joining a server
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class JoinServer extends Element {
/*
* Protected properties
*/
protected $tagName = 'join_server';
protected $login = null;
protected $serverIp = null;
protected $serverPort = null;
class JoinServer implements Element
{
/**
* Create a new JoinServer object
*
* @param string $login (optional) Server login
* @return static
*/
public static function create($login = null) {
return new static($login);
}
/**
* @var string $login Server login
*/
protected $login = null;
/**
* Construct a new JoinServer object
*
* @param string $login (optional) Server login
*/
public function __construct($login = null) {
if ($login !== null) {
$this->setLogin($login);
}
}
/**
* @var string $ip Server ip
*/
protected $ip = null;
/**
* Set the server login
*
* @param string $login Server login
* @return static
*/
public function setLogin($login) {
$this->login = (string)$login;
$this->serverIp = null;
$this->serverPort = null;
return $this;
}
/**
* @var int $port Server port
*/
protected $port = null;
/**
* Set the server ip and port
*
* @param string $serverIp Server ip
* @param int $serverPort Server port
* @return static
*/
public function setIp($serverIp, $serverPort) {
$this->serverIp = (string)$serverIp;
$this->serverPort = (int)$serverPort;
$this->login = null;
return $this;
}
/**
* Create a new JoinServer Element
*
* @api
* @param string $loginOrIp (optional) Server login or ip
* @param int $port (optional) Server port
* @return static
*/
public static function create($loginOrIp = null, $port = null)
{
return new static($loginOrIp, $port);
}
/**
* Construct a new JoinServer Element
*
* @api
* @param string $loginOrIp (optional) Server login or ip
* @param int $port (optional) Server port
*/
public function __construct($loginOrIp = null, $port = null)
{
if ($port) {
$this->setIp($loginOrIp, $port);
} elseif ($loginOrIp) {
$this->setLogin($loginOrIp);
}
}
/**
* Get the server login
*
* @api
* @return string
*/
public function getLogin()
{
return $this->login;
}
/**
* Set the server login
*
* @api
* @param string $login Server login
* @return static
*/
public function setLogin($login)
{
$this->login = (string)$login;
$this->ip = null;
$this->port = null;
return $this;
}
/**
* Get the server ip
*
* @api
* @return string
*/
public function getIp()
{
return $this->ip;
}
/**
* Set the server ip and port
*
* @api
* @param string $ip Server ip
* @param int $port (optional) Server port
* @return static
*/
public function setIp($ip, $port = null)
{
$this->login = null;
$this->ip = (string)$ip;
if ($port) {
$this->setPort($port);
}
return $this;
}
/**
* Get the server port
*
* @api
* @return int
*/
public function getPort()
{
return $this->port;
}
/**
* Set the server port
*
* @param int $port Server port
* @return static
*/
public function setPort($port)
{
$this->port = (int)$port;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("join_server");
if ($this->login) {
$loginElement = $domDocument->createElement("login", $this->login);
$domElement->appendChild($loginElement);
} else {
$ipElement = $domDocument->createElement("ip", $this->ip . ":" . $this->port);
$domElement->appendChild($ipElement);
}
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
if ($this->serverIp === null) {
$loginElement = $domDocument->createElement('login', $this->login);
$xmlElement->appendChild($loginElement);
} else {
$ipElement = $domDocument->createElement('ip', $this->serverIp . ':' . $this->serverPort);
$xmlElement->appendChild($ipElement);
}
return $xmlElement;
}
}

View File

@ -6,74 +6,114 @@ namespace FML\ManiaCode;
* ManiaCode Element for playing a map
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class PlayMap extends Element {
/*
* Protected properties
*/
protected $tagName = 'play_map';
protected $name = null;
protected $url = null;
class PlayMap implements Element
{
/**
* Create a new PlayMap object
*
* @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);
}
/*+
* @var string $name Map name
*/
protected $name = null;
/**
* Construct a new PlayMap object
*
* @param string $name (optional) Map name
* @param string $url (optional) Map url
*/
public function __construct($name = null, $url = null) {
if ($name !== null) {
$this->setName($name);
}
if ($url !== null) {
$this->setUrl($url);
}
}
/**
* @var string $url Map url
*/
protected $url = null;
/**
* Set the name of the map
*
* @param string $name Map name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* Create a new PlayMap 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);
}
/**
* Set the url of the map
*
* @param string $url Map url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* Construct a new PlayMap 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("play_map");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
}

View File

@ -6,74 +6,114 @@ namespace FML\ManiaCode;
* ManiaCode Element playing a replay
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class PlayReplay extends Element {
/*
* Protected properties
*/
protected $tagName = 'play_replay';
protected $name = null;
protected $url = null;
class PlayReplay implements Element
{
/**
* Create a new PlayReplay object
*
* @param string $name (optional) Replay name
* @param string $url (optional) Replay url
* @return static
*/
public static function create($name = null, $url = null) {
return new static($name, $url);
}
/**
* @var string $name Replay name
*/
protected $name = null;
/**
* Construct a new PlayReplay object
*
* @param string $name (optional) Replay name
* @param string $url (optional) Replay url
*/
public function __construct($name = null, $url = null) {
if ($name !== null) {
$this->setName($name);
}
if ($url !== null) {
$this->setUrl($url);
}
}
/**
* @var string $url Replay url
*/
protected $url = null;
/**
* Set the name of the replay
*
* @param string $name Replay name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* Create a new PlayReplay Element
*
* @api
* @param string $name (optional) Replay name
* @param string $url (optional) Replay url
* @return static
*/
public static function create($name = null, $url = null)
{
return new static($name, $url);
}
/**
* Set the url of the replay
*
* @param string $url Replay url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* Construct a new PlayReplay Element
*
* @api
* @param string $name (optional) Replay name
* @param string $url (optional) Replay url
*/
public function __construct($name = null, $url = null)
{
if ($name) {
$this->setName($name);
}
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the replay name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the replay name
*
* @api
* @param string $name Replay name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the replay url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the replay url
*
* @api
* @param string $url Replay url
* @return static
*/
public function setUrl($url)
{
$this->url = (string)$url;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("play_replay");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
}

View File

@ -6,55 +6,77 @@ namespace FML\ManiaCode;
* ManiaCode Element showing a Message
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class ShowMessage extends Element {
/*
* Protected properties
*/
protected $tagName = 'show_message';
protected $message = null;
class ShowMessage implements Element
{
/**
* Create a new ShowMessage object
*
* @param string $message (optional) Message text
* @return static
*/
public static function create($message = null) {
return new static($message);
}
/**
* @var string $message Message text
*/
protected $message = null;
/**
* Construct a new ShowMessage object
*
* @param string $message (optional) Message text
*/
public function __construct($message = null) {
if ($message !== null) {
$this->setMessage($message);
}
}
/**
* Create a new ShowMessage Element
*
* @api
* @param string $message (optional) Message text
* @return static
*/
public static function create($message = null)
{
return new static($message);
}
/**
* Set the message text
*
* @param string $message Message text
* @return static
*/
public function setMessage($message) {
$this->message = (string)$message;
return $this;
}
/**
* 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;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$messageElement = $domDocument->createElement('message', $this->message);
$xmlElement->appendChild($messageElement);
return $xmlElement;
}
}

View File

@ -6,74 +6,114 @@ namespace FML\ManiaCode;
* ManiaCode Element for viewing a replay
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class ViewReplay extends Element {
/*
* Protected properties
*/
protected $tagName = 'view_replay';
protected $name = null;
protected $url = null;
class ViewReplay implements Element
{
/**
* Create a new ViewReplay object
*
* @param string $name (optional) Replay name
* @param string $url (optional) Replay url
* @return static
*/
public static function create($name = null, $url = null) {
return new static($name, $url);
}
/**
* @var string $name Replay name
*/
protected $name = null;
/**
* Construct a new ViewReplay object
*
* @param string $name (optional) Replay name
* @param string $url (optional) Replay url
*/
public function __construct($name = null, $url = null) {
if ($name !== null) {
$this->setName($name);
}
if ($url !== null) {
$this->setUrl($url);
}
}
/**
* @var string $url Replay url
*/
protected $url = null;
/**
* Set the name of the replay
*
* @param string $name Replay name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* Create a new ViewReplay Element
*
* @api
* @param string $name (optional) Replay name
* @param string $url (optional) Replay url
* @return static
*/
public static function create($name = null, $url = null)
{
return new static($name, $url);
}
/**
* Set the url of the replay
*
* @param string $url Replay url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* Construct a new ViewReplay Element
*
* @api
* @param string $name (optional) Replay name
* @param string $url (optional) Replay url
*/
public function __construct($name = null, $url = null)
{
if ($name) {
$this->setName($name);
}
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the replay name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the replay name
*
* @api
* @param string $name Replay name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the replay url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the replay url
*
* @api
* @param string $url Replay url
* @return static
*/
public function setUrl($url)
{
$this->url = (string)$url;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("view_replay");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
}