mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-12 01:44:09 +02:00
execute read-the-docs.sh
This commit is contained in:
64
Structural/Composite/index.rst
Normal file
64
Structural/Composite/index.rst
Normal file
@@ -0,0 +1,64 @@
|
||||
Composite
|
||||
=========
|
||||
|
||||
Purpose
|
||||
=======
|
||||
|
||||
To treat a group of objects the same way as a single instance of the
|
||||
object.
|
||||
|
||||
Examples
|
||||
========
|
||||
|
||||
- a form class instance handles all its form elements like a single
|
||||
instance of the form, when ``render()`` is called, it subsequently
|
||||
runs through all its child elements and calls ``render()`` on them
|
||||
- ``Zend_Config``: a tree of configuration options, each one is a
|
||||
``Zend_Config`` object itself
|
||||
|
||||
UML Diagram
|
||||
-----------
|
||||
|
||||
.. image:: uml/uml.png
|
||||
:alt: Alt Composite UML Diagram
|
||||
:align: center
|
||||
|
||||
Code
|
||||
----
|
||||
|
||||
You can also find these code on `GitHub`_
|
||||
|
||||
FormElement.php
|
||||
|
||||
.. literalinclude:: FormElement.php
|
||||
:language: php
|
||||
:linenos:
|
||||
|
||||
Form.php
|
||||
|
||||
.. literalinclude:: Form.php
|
||||
:language: php
|
||||
:linenos:
|
||||
|
||||
InputElement.php
|
||||
|
||||
.. literalinclude:: InputElement.php
|
||||
:language: php
|
||||
:linenos:
|
||||
|
||||
TextElement.php
|
||||
|
||||
.. literalinclude:: TextElement.php
|
||||
:language: php
|
||||
:linenos:
|
||||
|
||||
Test
|
||||
----
|
||||
|
||||
Tests/CompositeTest.php
|
||||
|
||||
.. literalinclude:: Tests/CompositeTest.php
|
||||
:language: php
|
||||
:linenos:
|
||||
|
||||
.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Structural/Composite
|
Reference in New Issue
Block a user