TrackManiaControl/libs/FML/ManiaCode/AddBuddy.php

83 lines
1.6 KiB
PHP
Raw Permalink Normal View History

2014-01-12 00:51:46 +01:00
<?php
namespace FML\ManiaCode;
/**
2014-06-21 03:18:21 +02:00
* ManiaCode Element adding a buddy
2014-01-12 00:51:46 +01:00
*
2014-06-21 03:18:21 +02:00
* @author steeffeen
2017-03-25 18:40:15 +01:00
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
2014-06-21 03:18:21 +02:00
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
2014-01-12 00:51:46 +01:00
*/
2017-03-25 18:40:15 +01:00
class AddBuddy implements Element
{
/**
* @var string $login Buddy login
*/
protected $login = null;
/**
* Create a new AddBuddy Element
*
* @api
* @param string $login (optional) Buddy login
* @return static
*/
public static function create($login = null)
{
return new static($login);
}
/**
* 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;
}
2014-01-12 00:51:46 +01:00
}