FML Update
This commit is contained in:
		| @@ -3,7 +3,7 @@ | ||||
| namespace FML\ManiaCode; | ||||
|  | ||||
| /** | ||||
|  * ManiaCode Element joining a Server | ||||
|  * ManiaCode Element for joining a server | ||||
|  * | ||||
|  * @author    steeffeen <mail@steeffeen.com> | ||||
|  * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder | ||||
| @@ -11,59 +11,58 @@ namespace FML\ManiaCode; | ||||
|  */ | ||||
| class JoinServer implements Element { | ||||
| 	/* | ||||
| 	 * Protected Properties | ||||
| 	 * Protected properties | ||||
| 	 */ | ||||
| 	protected $tagName = 'join_server'; | ||||
| 	protected $login = ''; | ||||
| 	protected $ip = null; | ||||
| 	protected $port = null; | ||||
| 	protected $login = null; | ||||
| 	protected $serverIp = null; | ||||
| 	protected $serverPort = null; | ||||
|  | ||||
| 	/** | ||||
| 	 * Create a new JoinServer Element | ||||
| 	 * Create a new JoinServer object | ||||
| 	 * | ||||
| 	 * @param string $login (optional) Server Login | ||||
| 	 * @return \FML\ManiaCode\JoinServer | ||||
| 	 * @param string $login (optional) Server login | ||||
| 	 * @return \FML\ManiaCode\JoinServer|static | ||||
| 	 */ | ||||
| 	public static function create($login = null) { | ||||
| 		$joinServer = new JoinServer($login); | ||||
| 		return $joinServer; | ||||
| 		return new static($login); | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * Construct a new JoinServer Element | ||||
| 	 * Construct a new JoinServer object | ||||
| 	 * | ||||
| 	 * @param string $login (optional) Server Login | ||||
| 	 * @param string $login (optional) Server login | ||||
| 	 */ | ||||
| 	public function __construct($login = null) { | ||||
| 		if ($login !== null) { | ||||
| 		if (!is_null($login)) { | ||||
| 			$this->setLogin($login); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * Set the Server Login | ||||
| 	 * Set the server login | ||||
| 	 * | ||||
| 	 * @param string $login Server Login | ||||
| 	 * @return \FML\ManiaCode\JoinServer | ||||
| 	 * @param string $login Server login | ||||
| 	 * @return \FML\ManiaCode\JoinServer|static | ||||
| 	 */ | ||||
| 	public function setLogin($login) { | ||||
| 		$this->login = (string)$login; | ||||
| 		$this->ip    = null; | ||||
| 		$this->port  = null; | ||||
| 		$this->login      = (string)$login; | ||||
| 		$this->serverIp   = null; | ||||
| 		$this->serverPort = null; | ||||
| 		return $this; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * Set the Server Ip and Port | ||||
| 	 * Set the server ip and port | ||||
| 	 * | ||||
| 	 * @param string $ip   Server Ip | ||||
| 	 * @param int    $port Server Port | ||||
| 	 * @return \FML\ManiaCode\JoinServer | ||||
| 	 * @param string $serverIp   Server ip | ||||
| 	 * @param int    $serverPort Server port | ||||
| 	 * @return \FML\ManiaCode\JoinServer|static | ||||
| 	 */ | ||||
| 	public function setIp($ip, $port) { | ||||
| 		$this->ip    = (string)$ip; | ||||
| 		$this->port  = (int)$port; | ||||
| 		$this->login = null; | ||||
| 	public function setIp($serverIp, $serverPort) { | ||||
| 		$this->serverIp   = (string)$serverIp; | ||||
| 		$this->serverPort = (int)$serverPort; | ||||
| 		$this->login      = null; | ||||
| 		return $this; | ||||
| 	} | ||||
|  | ||||
| @@ -72,11 +71,11 @@ class JoinServer implements Element { | ||||
| 	 */ | ||||
| 	public function render(\DOMDocument $domDocument) { | ||||
| 		$xmlElement = $domDocument->createElement($this->tagName); | ||||
| 		if ($this->ip === null) { | ||||
| 		if (is_null($this->serverIp)) { | ||||
| 			$loginElement = $domDocument->createElement('login', $this->login); | ||||
| 			$xmlElement->appendChild($loginElement); | ||||
| 		} else { | ||||
| 			$ipElement = $domDocument->createElement('ip', $this->ip . ':' . $this->port); | ||||
| 			$ipElement = $domDocument->createElement('ip', $this->serverIp . ':' . $this->serverPort); | ||||
| 			$xmlElement->appendChild($ipElement); | ||||
| 		} | ||||
| 		return $xmlElement; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user