Updated to ManiaLink v3
This commit is contained in:
		| @@ -6,55 +6,77 @@ namespace FML\ManiaCode; | ||||
|  * ManiaCode Element for going to a link | ||||
|  * | ||||
|  * @author    steeffeen | ||||
|  * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder | ||||
|  * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder | ||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||
|  */ | ||||
| class Go_To extends Element { | ||||
| 	/* | ||||
| 	 * Protected properties | ||||
| 	 */ | ||||
| 	protected $tagName = 'goto'; | ||||
| 	protected $link = null; | ||||
| class Go_To implements Element | ||||
| { | ||||
|  | ||||
| 	/** | ||||
| 	 * Create a new Go_To object | ||||
| 	 * | ||||
| 	 * @param string $link (optional) Goto link | ||||
| 	 * @return static | ||||
| 	 */ | ||||
| 	public static function create($link = null) { | ||||
| 		return new static($link); | ||||
| 	} | ||||
|     /** | ||||
|      * @var string $link Link | ||||
|      */ | ||||
|     protected $link = null; | ||||
|  | ||||
| 	/** | ||||
| 	 * Construct a new Go_To object | ||||
| 	 * | ||||
| 	 * @param string $link (optional) Goto link | ||||
| 	 */ | ||||
| 	public function __construct($link = null) { | ||||
| 		if ($link !== null) { | ||||
| 			$this->setLink($link); | ||||
| 		} | ||||
| 	} | ||||
|     /** | ||||
|      * Create a new Go_To Element | ||||
|      * | ||||
|      * @api | ||||
|      * @param string $link (optional) Link | ||||
|      * @return static | ||||
|      */ | ||||
|     public static function create($link = null) | ||||
|     { | ||||
|         return new static($link); | ||||
|     } | ||||
|  | ||||
| 	/** | ||||
| 	 * Set link | ||||
| 	 * | ||||
| 	 * @param string $link Goto link | ||||
| 	 * @return static | ||||
| 	 */ | ||||
| 	public function setLink($link) { | ||||
| 		$this->link = (string)$link; | ||||
| 		return $this; | ||||
| 	} | ||||
|     /** | ||||
|      * Construct a new Go_To Element | ||||
|      * | ||||
|      * @api | ||||
|      * @param string $link (optional) Link | ||||
|      */ | ||||
|     public function __construct($link = null) | ||||
|     { | ||||
|         if ($link) { | ||||
|             $this->setLink($link); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get the link | ||||
|      * | ||||
|      * @api | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getLink() | ||||
|     { | ||||
|         return $this->link; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set the link | ||||
|      * | ||||
|      * @api | ||||
|      * @param string $link Link | ||||
|      * @return static | ||||
|      */ | ||||
|     public function setLink($link) | ||||
|     { | ||||
|         $this->link = (string)$link; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @see Element::render() | ||||
|      */ | ||||
|     public function render(\DOMDocument $domDocument) | ||||
|     { | ||||
|         $domElement = $domDocument->createElement("goto"); | ||||
|  | ||||
|         $linkElement = $domDocument->createElement("link", $this->link); | ||||
|         $domElement->appendChild($linkElement); | ||||
|  | ||||
|         return $domElement; | ||||
|     } | ||||
|  | ||||
| 	/** | ||||
| 	 * @see \FML\ManiaCode\Element::render() | ||||
| 	 */ | ||||
| 	public function render(\DOMDocument $domDocument) { | ||||
| 		$xmlElement  = parent::render($domDocument); | ||||
| 		$linkElement = $domDocument->createElement('link', $this->link); | ||||
| 		$xmlElement->appendChild($linkElement); | ||||
| 		return $xmlElement; | ||||
| 	} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user