mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-03 13:37:27 +02:00
spacing
This commit is contained in:
@@ -15,7 +15,6 @@ namespace DesignPatterns\Decorator;
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* the Deoorator MUST implement the Renderer contract, this is the key-feature
|
||||
* of this design pattern. If not, this is no longer a Decorator but just a dumb
|
||||
@@ -23,6 +22,7 @@ namespace DesignPatterns\Decorator;
|
||||
*/
|
||||
abstract class Decorator implements Renderer
|
||||
{
|
||||
|
||||
protected $_wrapped;
|
||||
|
||||
/**
|
||||
@@ -35,5 +35,5 @@ abstract class Decorator implements Renderer
|
||||
{
|
||||
$this->_wrapped = $wrappable;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,9 +4,11 @@ namespace DesignPatterns\Decorator;
|
||||
|
||||
class RenderInJson extends Decorator
|
||||
{
|
||||
|
||||
public function renderData()
|
||||
{
|
||||
$output = $this->_wrapped->renderData();
|
||||
return json_encode($output);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ namespace DesignPatterns\Decorator;
|
||||
|
||||
class RenderInXml extends Decorator
|
||||
{
|
||||
|
||||
public function renderData()
|
||||
{
|
||||
$output = $this->_wrapped->renderData();
|
||||
@@ -15,4 +16,5 @@ class RenderInXml extends Decorator
|
||||
|
||||
return $doc->saveXML();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,5 +4,6 @@ namespace DesignPatterns\Decorator;
|
||||
|
||||
interface Renderer
|
||||
{
|
||||
|
||||
public function renderData();
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ namespace DesignPatterns\Decorator;
|
||||
|
||||
class Webservice implements Renderer
|
||||
{
|
||||
|
||||
protected $_data;
|
||||
|
||||
public function __construct($data)
|
||||
@@ -15,4 +16,5 @@ class Webservice implements Renderer
|
||||
{
|
||||
return $this->_data;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user