2014-01-12 00:51:46 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace FML\ManiaCode;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ManiaCode Element adding a Buddy
|
|
|
|
*
|
|
|
|
* @author steeffeen
|
2014-04-13 18:21:40 +02:00
|
|
|
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
|
|
|
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
2014-01-12 00:51:46 +01:00
|
|
|
*/
|
|
|
|
class AddBuddy implements Element {
|
2014-01-21 20:30:40 +01:00
|
|
|
/*
|
2014-01-12 00:51:46 +01:00
|
|
|
* Protected Properties
|
|
|
|
*/
|
|
|
|
protected $tagName = 'add_buddy';
|
|
|
|
protected $login = '';
|
|
|
|
|
2014-01-19 19:30:21 +01:00
|
|
|
/**
|
|
|
|
* Construct a new AddBuddy Element
|
|
|
|
*
|
|
|
|
* @param string $login (optional) Buddy Login
|
|
|
|
* @return \FML\ManiaCode\AddBuddy
|
|
|
|
*/
|
|
|
|
public static function create($login = null) {
|
|
|
|
$addBuddy = new AddBuddy($login);
|
|
|
|
return $addBuddy;
|
|
|
|
}
|
|
|
|
|
2014-01-12 00:51:46 +01:00
|
|
|
/**
|
|
|
|
* Construct a new AddBuddy Element
|
|
|
|
*
|
|
|
|
* @param string $login (optional) Buddy Login
|
|
|
|
*/
|
|
|
|
public function __construct($login = null) {
|
|
|
|
if ($login !== null) {
|
|
|
|
$this->setLogin($login);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the Buddy Login
|
|
|
|
*
|
|
|
|
* @param string $login Buddy Login
|
|
|
|
* @return \FML\ManiaCode\AddBuddy
|
|
|
|
*/
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|