mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-01 12:40:11 +02:00
execute read-the-docs.sh
This commit is contained in:
40
Creational/Multiton/index.rst
Normal file
40
Creational/Multiton/index.rst
Normal file
@@ -0,0 +1,40 @@
|
||||
Multiton
|
||||
========
|
||||
|
||||
**THIS IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND
|
||||
MAINTAINABILITY USE DEPENDENCY INJECTION!**
|
||||
|
||||
Purpose
|
||||
=======
|
||||
|
||||
To have only a list of named instances that are used, like a singleton
|
||||
but with n instances.
|
||||
|
||||
Examples
|
||||
========
|
||||
|
||||
- 2 DB Connectors, e.g. one for MySQL, the other for SQLite
|
||||
- multiple Loggers (one for debug messages, one for errors)
|
||||
|
||||
UML Diagram
|
||||
-----------
|
||||
|
||||
.. image:: uml/uml.png
|
||||
:alt: Alt Multiton UML Diagram
|
||||
:align: center
|
||||
|
||||
Code
|
||||
----
|
||||
|
||||
You can also find these code on `GitHub`_
|
||||
|
||||
Multiton.php
|
||||
|
||||
.. literalinclude:: Multiton.php
|
||||
:language: php
|
||||
:linenos:
|
||||
|
||||
Test
|
||||
----
|
||||
|
||||
.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Creational/Multiton
|
Reference in New Issue
Block a user