mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-31 20:20:15 +02:00
README Decorator
This commit is contained in:
@@ -2,24 +2,15 @@
|
|||||||
|
|
||||||
namespace DesignPatterns\Decorator;
|
namespace DesignPatterns\Decorator;
|
||||||
|
|
||||||
/**
|
|
||||||
* Decorator pattern
|
|
||||||
*
|
|
||||||
* Purpose:
|
|
||||||
* to dynamically add new functionality to class instances
|
|
||||||
*
|
|
||||||
* Examples:
|
|
||||||
* - Zend Framework: decorators for Zend_Form_Element instances
|
|
||||||
* - Web Service Layer: Decorators JSON and XML for a REST service (in this case, only one of these should be allowed of
|
|
||||||
* course)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the Deoorator MUST implement the RendererInterface contract, this is the key-feature
|
* the Deoorator 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
|
* of this design pattern. If not, this is no longer a Decorator but just a dumb
|
||||||
* wrapper.
|
* wrapper.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* class Decorator
|
||||||
|
*/
|
||||||
abstract class Decorator implements RendererInterface
|
abstract class Decorator implements RendererInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
10
Decorator/README.md
Normal file
10
Decorator/README.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Decorator
|
||||||
|
|
||||||
|
## Purpose
|
||||||
|
|
||||||
|
To dynamically add new functionality to class instances.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
* Zend Framework: decorators for Zend_Form_Element instances
|
||||||
|
* Web Service Layer: Decorators JSON and XML for a REST service (in this case, only one of these should be allowed of course)
|
Reference in New Issue
Block a user