mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-30 19:50:12 +02:00
PHP7 Decorator
This commit is contained in:
24
Structural/Decorator/RendererDecorator.php
Normal file
24
Structural/Decorator/RendererDecorator.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\Structural\Decorator;
|
||||
|
||||
/**
|
||||
* the Decorator MUST implement the RendererInterface contract, this is the key-feature
|
||||
* of this design pattern. If not, this is no longer a Decorator but just a dumb
|
||||
* wrapper.
|
||||
*/
|
||||
abstract class RendererDecorator
|
||||
{
|
||||
/**
|
||||
* @var RenderableInterface
|
||||
*/
|
||||
protected $wrapped;
|
||||
|
||||
/**
|
||||
* @param RenderableInterface $renderer
|
||||
*/
|
||||
public function __construct(RenderableInterface $renderer)
|
||||
{
|
||||
$this->wrapped = $renderer;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user