README Registry

This commit is contained in:
Dominik Liebler 2013-09-24 14:07:04 +02:00
parent 4d916f3ffe
commit 59001ecf92
3 changed files with 14 additions and 12 deletions

11
Registry/README.md Normal file
View File

@ -0,0 +1,11 @@
# Registry
## 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: `Zend_Registry` holds the application's logger object, front controller etc.
* Yii Framework: `CWebApplication` holds all the application components, such as `CWebUser`, `CUrlManager`, etc.

View File

@ -1,18 +1,9 @@
<?php
namespace DesignPatterns;
namespace DesignPatterns\Registry;
/**
* Registry pattern
*
* 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)
*
* Example:
* - Zend Framework: Zend_Registry holds the application's logger object, front controller etc.
* - Yii Framework: CWebApplication holds all the application components, such as CWebUser, CUrlManager, etc.
*
* class Registry
*/
abstract class Registry
{

View File

@ -1,6 +1,6 @@
<?php
use DesignPatterns\Registry;
use DesignPatterns\Registry\Registry;
// while bootstrapping the application
Registry::set(Registry::LOGGER, new \StdClass());