Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Use Singleton parent class app-wide? #4208

Closed
mattab opened this Issue · 6 comments

2 participants

@mattab
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...)

@halfdan
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

@mattab
Owner

In 13b35fa: Refs #4208 Remove translate singleton

@mattab
Owner

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

@mattab
Owner

In b9654b6: Refs #4208 Plugin classes moved

@mattab
Owner

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

@mattab
Owner

In 7da0007: Refs #4208 refactor some singletons

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

(some tests failing)
c782b8c
@sabl0r sabl0r referenced this issue from a commit in sabl0r/piwik
@mattab 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.