1
0
mirror of https://github.com/DesignPatternsPHP/DesignPatternsPHP.git synced 2025-07-10 09:56:24 +02:00

fixed return type of RendererInterface

This commit is contained in:
Dominik Liebler
2016-05-13 10:23:19 +02:00
parent 3fcf860cf3
commit acdef3f6e9
3 changed files with 5 additions and 9 deletions

@ -10,12 +10,10 @@ class RenderInJson extends Decorator
/**
* render data as JSON.
*
* @return mixed|string
* @return string
*/
public function renderData()
{
$output = $this->wrapped->renderData();
return json_encode($output);
return json_encode($this->wrapped->renderData());
}
}

@ -10,17 +10,15 @@ class RenderInXml extends Decorator
/**
* render data as XML.
*
* @return mixed|string
* @return string
*/
public function renderData()
{
$output = $this->wrapped->renderData();
// do some fancy conversion to xml from array ...
$doc = new \DOMDocument();
foreach ($output as $key => $val) {
foreach ($this->wrapped->renderData() as $key => $val) {
$doc->appendChild($doc->createElement($key, $val));
}

@ -10,7 +10,7 @@ interface RendererInterface
/**
* render data.
*
* @return mixed
* @return string
*/
public function renderData();
}