moved Libs out of core folder
This commit is contained in:
63
application/libs/FML/Elements/Music.php
Normal file
63
application/libs/FML/Elements/Music.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace FML\Elements;
|
||||
|
||||
use FML\Types\Renderable;
|
||||
|
||||
/**
|
||||
* Music Element
|
||||
*
|
||||
* @author steeffeen <mail@steeffeen.com>
|
||||
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class Music implements Renderable {
|
||||
/*
|
||||
* Protected properties
|
||||
*/
|
||||
protected $tagName = 'music';
|
||||
protected $data = null;
|
||||
|
||||
/**
|
||||
* Create a new Music object
|
||||
*
|
||||
* @param string $data (optional) Media url
|
||||
* @return static
|
||||
*/
|
||||
public static function create($data = null) {
|
||||
return new static($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new Music object
|
||||
*
|
||||
* @param string $data (optional) Media url
|
||||
*/
|
||||
public function __construct($data = null) {
|
||||
if (!is_null($data)) {
|
||||
$this->setData($data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set data url
|
||||
*
|
||||
* @param string $data Data url
|
||||
* @return static
|
||||
*/
|
||||
public function setData($data) {
|
||||
$this->data = (string)$data;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \FML\Types\Renderable::render()
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
$xmlElement = $domDocument->createElement($this->tagName);
|
||||
if ($this->data) {
|
||||
$xmlElement->setAttribute('data', $this->data);
|
||||
}
|
||||
return $xmlElement;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user