mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-13 02:14:04 +02:00
Change index.rst to README.rst
remove all pattern's README.md
This commit is contained in:
68
Structural/Decorator/README.rst
Normal file
68
Structural/Decorator/README.rst
Normal file
@@ -0,0 +1,68 @@
|
||||
`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)
|
||||
|
||||
UML Diagram
|
||||
-----------
|
||||
|
||||
.. image:: uml/uml.png
|
||||
:alt: Alt Decorator UML Diagram
|
||||
:align: center
|
||||
|
||||
Code
|
||||
----
|
||||
|
||||
You can also find these code on `GitHub`_
|
||||
|
||||
RendererInterface.php
|
||||
|
||||
.. literalinclude:: RendererInterface.php
|
||||
:language: php
|
||||
:linenos:
|
||||
|
||||
RenderInXml.php
|
||||
|
||||
.. literalinclude:: RenderInXml.php
|
||||
:language: php
|
||||
:linenos:
|
||||
|
||||
Webservice.php
|
||||
|
||||
.. literalinclude:: Webservice.php
|
||||
:language: php
|
||||
:linenos:
|
||||
|
||||
RenderInJson.php
|
||||
|
||||
.. literalinclude:: RenderInJson.php
|
||||
:language: php
|
||||
:linenos:
|
||||
|
||||
Decorator.php
|
||||
|
||||
.. literalinclude:: Decorator.php
|
||||
:language: php
|
||||
:linenos:
|
||||
|
||||
Test
|
||||
----
|
||||
|
||||
Tests/DecoratorTest.php
|
||||
|
||||
.. literalinclude:: Tests/DecoratorTest.php
|
||||
:language: php
|
||||
:linenos:
|
||||
|
||||
.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Structural/Decorator
|
||||
.. _`Decorator`: http://en.wikipedia.org/wiki/Decorator_pattern
|
Reference in New Issue
Block a user