mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-31 20:20:15 +02:00
README Registry
This commit is contained in:
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
|
<?php
|
||||||
|
|
||||||
namespace DesignPatterns;
|
namespace DesignPatterns\Registry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registry pattern
|
* class 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)
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
abstract class Registry
|
abstract class Registry
|
||||||
{
|
{
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use DesignPatterns\Registry;
|
use DesignPatterns\Registry\Registry;
|
||||||
|
|
||||||
// while bootstrapping the application
|
// while bootstrapping the application
|
||||||
Registry::set(Registry::LOGGER, new \StdClass());
|
Registry::set(Registry::LOGGER, new \StdClass());
|
||||||
|
Reference in New Issue
Block a user