mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-05-30 18:39:38 +02:00
README Registry
This commit is contained in:
parent
4d916f3ffe
commit
59001ecf92
11
Registry/README.md
Normal file
11
Registry/README.md
Normal 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.
|
@ -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
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use DesignPatterns\Registry;
|
||||
use DesignPatterns\Registry\Registry;
|
||||
|
||||
// while bootstrapping the application
|
||||
Registry::set(Registry::LOGGER, new \StdClass());
|
||||
|
Loading…
x
Reference in New Issue
Block a user