mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-02-24 09:42:24 +01:00
README Singleton
This commit is contained in:
parent
d05a8beb9c
commit
5e0fe5445d
13
Singleton/README.md
Normal file
13
Singleton/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Singleton
|
||||
|
||||
**THIS IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND MAINTAINABILITY USE DEPENDENCY INJECTION!**
|
||||
|
||||
## Purpose
|
||||
|
||||
To have only one instance of this object in the application that will handle all calls.
|
||||
|
||||
## Examples
|
||||
|
||||
* DB Connector
|
||||
* Logger (may also be a Multiton if there are many log files for several purposes)
|
||||
* Lock file for the application (there is only one in the filesystem ...)
|
@ -3,19 +3,7 @@
|
||||
namespace DesignPatterns\Singleton;
|
||||
|
||||
/**
|
||||
* Singleton pattern
|
||||
*
|
||||
* --------------------------------------------------------------------------------------------------------------
|
||||
* THIS IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND MAINTAINABILITY USE DEPENDENCY INJECTION!
|
||||
* --------------------------------------------------------------------------------------------------------------
|
||||
*
|
||||
* Purpose:
|
||||
* to have only one instance of this object in the application that will handle all calls
|
||||
*
|
||||
* Examples:
|
||||
* - DB Connector
|
||||
* - Logger (may also be a Multiton if there are many log files for several purposes)
|
||||
* - Lock file for the application (there is only one in the filesystem ...)
|
||||
* class Singleton
|
||||
*/
|
||||
class Singleton
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user