folderstructure change
This commit is contained in:
committed by
Steffen Schröder
parent
043c85fa97
commit
570b32fff8
63
application/core/Libs/FML/Elements/Music.php
Normal file
63
application/core/Libs/FML/Elements/Music.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace FML\Elements;
|
||||
|
||||
use FML\Types\Renderable;
|
||||
|
||||
/**
|
||||
* Music Element
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
class Music implements Renderable {
|
||||
/*
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $tagName = 'music';
|
||||
protected $data = '';
|
||||
|
||||
/**
|
||||
* Create a new Music Element
|
||||
*
|
||||
* @param string $data (optional) Media Url
|
||||
* @return \FML\Elements\Music
|
||||
*/
|
||||
public static function create($data = null) {
|
||||
$music = new Music($data);
|
||||
return $music;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new Music Element
|
||||
*
|
||||
* @param string $data (optional) Media Url
|
||||
*/
|
||||
public function __construct($data = null) {
|
||||
if ($data !== null) {
|
||||
$this->setData($data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Data Url
|
||||
*
|
||||
* @param string $data Media Url
|
||||
* @return \FML\Elements\Music
|
||||
*/
|
||||
public function setData($data) {
|
||||
$this->data = (string) $data;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\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