PatternsSingletonTrait.php

Singleton Implemented Through Traits

This is an implementation of the singleton pattern using the traits functionality found in PHP 5.4. Any object that uses this trait enables the object to be used as a singleton. The advantage of this is that the object can then inherit from a separate object without having to rewrite the singleton behavior. To pass instantiation arguments on an initial set-up pass arguments to the instantiate() static method, this will then pass those arguments to the class' defined init method.

Traits

SingletonTrait The SingletonTrait trait