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,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;
}
}