TrackManiaControl/application/core/Libs/FML/ManiaCode/AddBuddy.php
Steffen Schröder c8d599189c FML Update
2014-06-21 03:18:21 +02:00

61 lines
1.3 KiB
PHP

<?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 implements Element {
/*
* Protected properties
*/
protected $tagName = 'add_buddy';
protected $login = null;
/**
* Create a new AddBuddy Element
*
* @param string $login (optional) Buddy login
* @return \FML\ManiaCode\AddBuddy|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 \FML\ManiaCode\AddBuddy|static
*/
public function setLogin($login) {
$this->login = (string)$login;
return $this;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = $domDocument->createElement($this->tagName);
$loginElement = $domDocument->createElement('login', $this->login);
$xmlElement->appendChild($loginElement);
return $xmlElement;
}
}