moved Libs out of core folder

This commit is contained in:
Steffen Schröder
2014-08-03 13:02:02 +02:00
parent 4d3dc92ad5
commit d517c2d561
180 changed files with 5 additions and 4 deletions

View File

@ -0,0 +1,60 @@
<?php
namespace FML\ManiaCode;
/**
* ManiaCode Element adding a buddy
*
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 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;
/**
* Create a new AddBuddy Element
*
* @param string $login (optional) Buddy login
* @return static
*/
public static function create($login = null) {
return new static($login);
}
/**
* Construct a new AddBuddy Element
*
* @param string $login (optional) Buddy login
*/
public function __construct($login = null) {
if (!is_null($login)) {
$this->setLogin($login);
}
}
/**
* Set the buddy login
*
* @param string $login Buddy login
* @return static
*/
public function setLogin($login) {
$this->login = (string)$login;
return $this;
}
/**
* @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

@ -0,0 +1,83 @@
<?php
namespace FML\ManiaCode;
/**
* ManiaCode Element adding a server as favorite
*
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 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;
/**
* Create a new AddFavorite object
*
* @param string $login (optional) Server login
* @return static
*/
public static function create($login = null) {
return new static($login);
}
/**
* Construct a new AddFavorite object
*
* @param string $login (optional) Server login
*/
public function __construct($login = null) {
if (!is_null($login)) {
$this->setLogin($login);
}
}
/**
* 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;
}
/**
* 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;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
if (is_null($this->serverIp)) {
$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

@ -0,0 +1,28 @@
<?php
namespace FML\ManiaCode;
/**
* Base ManiaCode Element
*
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
abstract class Element {
/*
* Protected properties
*/
protected $tagName = 'element';
/**
* 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

@ -0,0 +1,98 @@
<?php
namespace FML\ManiaCode;
/**
* ManiaCode Element downloading a skin
*
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 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;
/**
* 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);
}
/**
* 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 (!is_null($name)) {
$this->setName($name);
}
if (!is_null($file)) {
$this->setFile($file);
}
if (!is_null($url)) {
$this->setUrl($url);
}
}
/**
* Set the name of the skin
*
* @param string $name Skin name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* Set the file of the skin
*
* @param string $file Skin file
* @return static
*/
public function setFile($file) {
$this->file = (string)$file;
return $this;
}
/**
* Set the url of the skin
*
* @param string $url Skin url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* @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

@ -0,0 +1,60 @@
<?php
namespace FML\ManiaCode;
/**
* ManiaCode Element for going to a link
*
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 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;
/**
* Create a new Go_To object
*
* @param string $link (optional) Goto link
* @return static
*/
public static function create($link = null) {
return new static($link);
}
/**
* Construct a new Go_To object
*
* @param string $link (optional) Goto link
*/
public function __construct($link = null) {
if (!is_null($link)) {
$this->setLink($link);
}
}
/**
* Set link
*
* @param string $link Goto link
* @return static
*/
public function setLink($link) {
$this->link = (string)$link;
return $this;
}
/**
* @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

@ -0,0 +1,97 @@
<?php
namespace FML\ManiaCode;
/**
* ManiaCode Element installing a macroblock
*
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 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;
/**
* 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);
}
/**
* 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 (!is_null($name)) {
$this->setName($name);
}
if (!is_null($file)) {
$this->setFile($file);
}
if (!is_null($url)) {
$this->setUrl($url);
}
}
/**
* Set the name of the macroblock
*
* @param string $name Macroblock name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* Set the file of the macroblock
*
* @param string $file Macroblock file
* @return static
*/
public function setFile($file) {
$this->file = (string)$file;
return $this;
}
/**
* Set the url of the macroblock
*
* @param string $url Macroblock url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* @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

@ -0,0 +1,79 @@
<?php
namespace FML\ManiaCode;
/**
* ManiaCode Element installing a map
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 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;
/**
* 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);
}
/**
* 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 (!is_null($name)) {
$this->setName($name);
}
if (!is_null($url)) {
$this->setUrl($url);
}
}
/**
* Set the name of the map
*
* @param string $name Map name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* Set the url of the map
*
* @param string $url Map url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* @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

@ -0,0 +1,98 @@
<?php
namespace FML\ManiaCode;
/**
* ManiaCode Element installing a title pack
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 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;
/**
* 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);
}
/**
* 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 (!is_null($name)) {
$this->setName($name);
}
if (!is_null($file)) {
$this->setFile($file);
}
if (!is_null($url)) {
$this->setUrl($url);
}
}
/**
* Set the name of the pack
*
* @param string $name Pack name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* Set the file of the pack
*
* @param string $file Pack file
* @return static
*/
public function setFile($file) {
$this->file = (string)$file;
return $this;
}
/**
* Set the url of the pack
*
* @param string $url Pack url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* @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

@ -0,0 +1,79 @@
<?php
namespace FML\ManiaCode;
/**
* ManiaCode Element installing a replay
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 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;
/**
* 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);
}
/**
* 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 (!is_null($name)) {
$this->setName($name);
}
if (!is_null($url)) {
$this->setUrl($url);
}
}
/**
* Set the name of the replay
*
* @param string $name Replay name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* Set the url of the replay
*
* @param string $url Replay url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* @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

@ -0,0 +1,98 @@
<?php
namespace FML\ManiaCode;
/**
* ManiaCode Element installing a script
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 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;
/**
* 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);
}
/**
* 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 (!is_null($name)) {
$this->setName($name);
}
if (!is_null($file)) {
$this->setFile($file);
}
if (!is_null($url)) {
$this->setUrl($url);
}
}
/**
* Set the name of the script
*
* @param string $name Script name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* Set the file of the script
*
* @param string $file Script file
* @return static
*/
public function setFile($file) {
$this->file = (string)$file;
return $this;
}
/**
* Set the url of the script
*
* @param string $url Script url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* @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

@ -0,0 +1,98 @@
<?php
namespace FML\ManiaCode;
/**
* ManiaCode Element installing a skin
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 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;
/**
* 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);
}
/**
* 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 (!is_null($name)) {
$this->setName($name);
}
if (!is_null($file)) {
$this->setFile($file);
}
if (!is_null($url)) {
$this->setUrl($url);
}
}
/**
* Set the name of the skin
*
* @param string $name Skin name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* Set the file of the skin
*
* @param string $file Skin file
* @return static
*/
public function setFile($file) {
$this->file = (string)$file;
return $this;
}
/**
* Set the url of the skin
*
* @param string $url Skin url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* @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

@ -0,0 +1,83 @@
<?php
namespace FML\ManiaCode;
/**
* ManiaCode Element for joining a server
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 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;
/**
* Create a new JoinServer object
*
* @param string $login (optional) Server login
* @return static
*/
public static function create($login = null) {
return new static($login);
}
/**
* Construct a new JoinServer object
*
* @param string $login (optional) Server login
*/
public function __construct($login = null) {
if (!is_null($login)) {
$this->setLogin($login);
}
}
/**
* 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;
}
/**
* 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;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
if (is_null($this->serverIp)) {
$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

@ -0,0 +1,79 @@
<?php
namespace FML\ManiaCode;
/**
* ManiaCode Element for playing a map
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 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;
/**
* 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);
}
/**
* 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 (!is_null($name)) {
$this->setName($name);
}
if (!is_null($url)) {
$this->setUrl($url);
}
}
/**
* Set the name of the map
*
* @param string $name Map name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* Set the url of the map
*
* @param string $url Map url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* @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

@ -0,0 +1,79 @@
<?php
namespace FML\ManiaCode;
/**
* ManiaCode Element playing a replay
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 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;
/**
* 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);
}
/**
* 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 (!is_null($name)) {
$this->setName($name);
}
if (!is_null($url)) {
$this->setUrl($url);
}
}
/**
* Set the name of the replay
*
* @param string $name Replay name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* Set the url of the replay
*
* @param string $url Replay url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* @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

@ -0,0 +1,60 @@
<?php
namespace FML\ManiaCode;
/**
* ManiaCode Element showing a Message
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 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;
/**
* Create a new ShowMessage object
*
* @param string $message (optional) Message text
* @return static
*/
public static function create($message = null) {
return new static($message);
}
/**
* Construct a new ShowMessage object
*
* @param string $message (optional) Message text
*/
public function __construct($message = null) {
if (!is_null($message)) {
$this->setMessage($message);
}
}
/**
* Set the message text
*
* @param string $message Message text
* @return static
*/
public function setMessage($message) {
$this->message = (string)$message;
return $this;
}
/**
* @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

@ -0,0 +1,79 @@
<?php
namespace FML\ManiaCode;
/**
* ManiaCode Element for viewing a replay
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 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;
/**
* 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);
}
/**
* 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 (!is_null($name)) {
$this->setName($name);
}
if (!is_null($url)) {
$this->setUrl($url);
}
}
/**
* Set the name of the replay
*
* @param string $name Replay name
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/**
* Set the url of the replay
*
* @param string $url Replay url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* @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;
}
}