05-11-2009, 07:03 PM
|
#10 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
Creating a singleton is not just writing a method. The idea is to only ever have one instance of the class: mixing an instance stored in a class property with the ability to create as many instances you like (via __construct) defeats the point of trying to implement the singleton pattern.
I just used empty due to personal preference: "If not empty..." reads better, for me, than "if ... is not equal to null" and there isn't any requirement to be checking only for NULL (is there?). !== null, as you know, would work equally well in this case.
|
|
|
|