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