TrackManiaControl/application/core/FML/ManiaCode/Go_To.php

61 lines
1.1 KiB
PHP
Raw Normal View History

2014-01-12 00:51:46 +01:00
<?php
namespace FML\ManiaCode;
/**
* ManiaCode Element going to a Link
*
* @author steeffeen
*/
class Go_To implements Element {
2014-01-21 20:30:40 +01:00
/*
2014-01-12 00:51:46 +01:00
* Protected Properties
*/
protected $tagName = 'goto';
protected $link = '';
2014-01-19 19:30:21 +01:00
/**
* Create a new Go_To Element
*
* @param string $link (optional) Goto Link
* @return \FML\ManiaCode\Go_To
*/
public static function create($link = null) {
$goTo = new Go_To($link);
return $goTo;
}
2014-01-12 00:51:46 +01:00
/**
* Construct a new Go_To Element
*
* @param string $link (optional) Goto Link
*/
public function __construct($link = null) {
if ($link !== null) {
$this->setLink($link);
}
}
/**
* Set the Goto Link
*
* @param string $link Goto Link
* @return \FML\ManiaCode\Go_To
*/
public function setLink($link) {
$this->link = (string) $link;
return $this;
}
/**
*
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = $domDocument->createElement($this->tagName);
$linkElement = $domDocument->createElement('link', $this->link);
$xmlElement->appendChild($linkElement);
return $xmlElement;
}
}