mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-30 19:50:12 +02:00
README Decorator
This commit is contained in:
@@ -2,24 +2,15 @@
|
||||
|
||||
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
|
||||
* of this design pattern. If not, this is no longer a Decorator but just a dumb
|
||||
* wrapper.
|
||||
*/
|
||||
|
||||
/**
|
||||
* class Decorator
|
||||
*/
|
||||
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