[Solar-talk] Solar_Event_Dispatcher
Antti Holvikari
anttih at gmail.com
Thu Sep 21 01:49:34 PDT 2006
On 9/21/06, Andrew Shell <andrew at andrewshell.org> wrote:
> A possible implementation of the singleton method
>
> public static function singleton($class, $config = null)
> {
> $singleton_name = "_singleton_" . $class;
> if (!Solar::isRegistered($singleton_name)) {
> Solar::register($singleton_name, $class, $config);
> }
>
> $obj = Solar::registry($singleton_name);
> return $obj;
> }
This reminds me of one method from the "old days" :-). Guys take a
look http://solarphp.com/svn/tags/release-0.8.0/Solar.php, a method
called shared(). In the end I think the registry is better than a
simple singleton method.
--
Antti Holvikari <http://phphalo.com>
More information about the solar-talk
mailing list