cs Decorator

This commit is contained in:
Dominik Liebler
2013-09-11 16:18:40 +02:00
parent 9b3389ba4a
commit 79f94ba501
8 changed files with 66 additions and 32 deletions

View File

@@ -2,19 +2,28 @@
namespace DesignPatterns\Decorator;
/**
* Class RenderInXml
*/
class RenderInXml extends Decorator
{
/**
* render data as XML
*
* @return mixed|string
*/
public function renderData()
{
$output = $this->_wrapped->renderData();
// do some fany conversion to xml from array ...
$output = $this->wrapped->renderData();
// do some fancy conversion to xml from array ...
$doc = new \DOMDocument();
foreach ($output as $key => $val) {
$doc->appendChild($doc->createElement('foo', 'bar'));
}
return $doc->saveXML();
}
}