Find file History
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
Tests Replaced with strict assertions Sep 29, 2018
uml fixed Composite UML Sep 23, 2016
Form.php PHP7 Composite Sep 22, 2016
InputElement.php PHP7 Composite Sep 22, 2016
README.rst Improve grammar: these code > this code Apr 4, 2017
RenderableInterface.php PHP7 Composite Sep 22, 2016
TextElement.php PHP7 Composite Sep 22, 2016

README.rst

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

Alt Composite UML Diagram

Code

You can also find this code on GitHub

RenderableInterface.php

.. literalinclude:: RenderableInterface.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: