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

@ -8,56 +8,76 @@ use FML\Types\Renderable;
* Include Element
*
* @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 Including implements Renderable {
/*
* Protected properties
*/
protected $tagName = 'include';
protected $url = null;
class Including implements Renderable
{
/**
* Create a new Include object
*
* @param string $url (optional) Include url
* @return static
*/
public static function create($url = null) {
return new static($url);
}
/**
* @var string $url Include url
*/
protected $url = null;
/**
* Construct a new Include object
*
* @param string $url (optional) Include url
*/
public function __construct($url = null) {
if ($url !== null) {
$this->setUrl($url);
}
}
/**
* Create a new Include
*
* @api
* @param string $url (optional) Include url
* @return static
*/
public static function create($url = null)
{
return new static($url);
}
/**
* Set url
*
* @param string $url Include url
* @return static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**
* Construct a new Include
*
* @api
* @param string $url (optional) Include url
*/
public function __construct($url = null)
{
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the url
*
* @api
* @param string $url Include url
* @return static
*/
public function setUrl($url)
{
$this->url = (string)$url;
return $this;
}
/**
* @see Renderable::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("include");
if ($this->url) {
$domElement->setAttribute("url", $this->url);
}
return $domElement;
}
/**
* @see \FML\Types\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = $domDocument->createElement($this->tagName);
if ($this->url) {
$xmlElement->setAttribute('url', $this->url);
}
return $xmlElement;
}
}