Skip to content

Files

Latest commit

Dominik LieblerStyleCIBot
Dominik Liebler
and
Dec 21, 2015
fe1f144 · Dec 21, 2015

History

History
This branch is 737 commits behind DesignPatternsPHP/DesignPatternsPHP:main.

Registry

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Dec 21, 2015
Jul 31, 2014
Jul 6, 2015
Dec 21, 2015

Purpose

To implement a central storage for objects often used throughout the application, is typically implemented using an abstract class with only static methods (or using the Singleton pattern)

Examples

  • Zend Framework 1: Zend_Registry holds the application's logger object, front controller etc.
  • Yii Framework: CWebApplication holds all the application components, such as CWebUser, CUrlManager, etc.

UML Diagram

Alt Registry UML Diagram

Code

You can also find these code on GitHub

Registry.php

.. literalinclude:: Registry.php
   :language: php
   :linenos:

Test

Tests/RegistryTest.php

.. literalinclude:: Tests/RegistryTest.php
   :language: php
   :linenos: