FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [View Raw Code]   [Original HTTPS Page]

DesignPatternsPHP/Creational/Multiton at master · chey/DesignPatternsPHP · GitHub

Repository navigation

Latest commit

 

History

History
 
 
  1. DesignPatternsPHP
  2. Creational

Multiton

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.rst

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

Code

You can also find these code on GitHub

Multiton.php

.. literalinclude:: Multiton.php
   :language: php
   :linenos:

Test


Back | FazBrowse Home | New Git URL