Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Use Singleton parent class app-wide? #4208

Closed
mattab opened this Issue · 6 comments

2 participants

Matthieu Aubry Fabian Becker
Matthieu Aubry
Owner

Now that we use php 5.3, maybe it's possible to have all singletons inherit a clean Singleton abstract. Currently having to write the getInstance function is lengthy.

maybe this solution: http://stackoverflow.com/questions/3972628/creating-a-singleton-base-class-in-php-5-3?answertab=votes#tab-top

Note: we have 53 singletons in Piwik!! (because all API are singleton for example + 18 singleton in core...)

Fabian Becker
Collaborator

Doing this would prevent all these classes from extending another class.

We should maybe also rethink some of these singletons: http://stackoverflow.com/questions/137975/what-is-so-bad-about-singletons

Matthieu Aubry
Owner

In 13b35fa: Refs #4208 Remove translate singleton

Matthieu Aubry
Owner

In b6a4d25: Refs #4208 Move Plugin classes to core/Plugin for clarity

Matthieu Aubry
Owner

In b9654b6: Refs #4208 Plugin classes moved

Matthieu Aubry
Owner

In c782b8c: Refs #4208 refactor all singletons except the hard ones (with custom getInstance()
(some tests failing)

Matthieu Aubry
Owner

In 7da0007: Refs #4208 refactor some singletons

Matthieu Aubry mattab added this to the 2.0 - Piwik 2.0 milestone
Philip Taffner sabl0r referenced this issue from a commit in sabl0r/piwik
Matthieu Aubry mattab Refs #4208 Remove translate singleton 13b35fa
Philip Taffner sabl0r referenced this issue from a commit in sabl0r/piwik
Matthieu Aubry mattab Refs #4208 Plugin classes moved b9654b6
Philip Taffner sabl0r referenced this issue from a commit in sabl0r/piwik
Matthieu Aubry mattab Refs #4208 refactor all singletons except the hard ones (with custom …
…getInstance()

(some tests failing)
c782b8c
Philip Taffner sabl0r referenced this issue from a commit in sabl0r/piwik
Matthieu Aubry mattab Refs #4208 refactor some singletons 7da0007
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.