Store static in class, not function
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 20 Nov 2009 18:51:59 +0000 (11:51 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 20 Nov 2009 19:03:06 +0000 (12:03 -0700)
imp/lib/Folder.php

index af08155..df9fdeb 100644 (file)
 class IMP_Folder
 {
     /**
+     * Singleton instance.
+     *
+     * @var IMP_Folder
+     */
+    static protected $_instance = null;
+
+    /**
      * Keep around identical lists so that we don't hit the server more that
      * once in the same page for the same thing.
      *
@@ -41,13 +48,11 @@ class IMP_Folder
      */
     static public function singleton()
     {
-        static $folder;
-
-        if (!isset($folder)) {
-            $folder = new IMP_Folder();
+        if (is_null(self::$_instance)) {
+            self::$_instance = new IMP_Folder();
         }
 
-        return $folder;
+        return self::$_instance;
     }
 
     /**