Make singleton/factory classname agnostic
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 18 Dec 2009 18:53:26 +0000 (11:53 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 18 Dec 2009 20:04:42 +0000 (13:04 -0700)
imp/lib/Accounts.php
imp/lib/Compose.php
imp/lib/Contents.php
imp/lib/Folder.php
imp/lib/Imap/Acl.php
imp/lib/Imap/Flags.php
imp/lib/Imap/Tree.php
imp/lib/Mailbox.php
imp/lib/Message.php
imp/lib/Quota.php

index 483bcff..ca9b7ad 100644 (file)
@@ -36,7 +36,7 @@ class IMP_Accounts
     static public function singleton()
     {
         if (!isset(self::$_instance)) {
-            self::$_instance = new IMP_Accounts();
+            self::$_instance = new self();
         }
 
         return self::$_instance;
index 3b17326..5efe298 100644 (file)
@@ -105,7 +105,7 @@ class IMP_Compose
 
         if (is_null($cacheid) || empty(self::$_instances[$cacheid])) {
             $cacheid = is_null($cacheid) ? uniqid(mt_rand()) : $cacheid;
-            self::$_instances[$cacheid] = new IMP_Compose($cacheid);
+            self::$_instances[$cacheid] = new self($cacheid);
         }
 
         return self::$_instances[$cacheid];
index d2f6359..535b16b 100644 (file)
@@ -112,7 +112,7 @@ class IMP_Contents
             : $in;
 
         if (empty(self::$_instances[$sig])) {
-            self::$_instances[$sig] = new IMP_Contents($in);
+            self::$_instances[$sig] = new self($in);
         }
 
         return self::$_instances[$sig];
index ece5b71..b42f809 100644 (file)
@@ -49,7 +49,7 @@ class IMP_Folder
     static public function singleton()
     {
         if (is_null(self::$_instance)) {
-            self::$_instance = new IMP_Folder();
+            self::$_instance = new self();
         }
 
         return self::$_instance;
index 9f11d82..3cc1bcb 100644 (file)
@@ -45,7 +45,7 @@ class IMP_Imap_Acl
     static public function singleton()
     {
         if (!self::$_instance) {
-            self::$_instance = new IMP_Imap_Acl();
+            self::$_instance = new self();
         }
 
         return self::$_instance;
index 21e3fd7..5a2e496 100644 (file)
@@ -39,7 +39,7 @@ class IMP_Imap_Flags
     static public function singleton()
     {
         if (!isset(self::$_instance)) {
-            self::$_instance = new IMP_Imap_Flags();
+            self::$_instance = new self();
         }
 
         return self::$_instance;
index d1db492..5c8fd2f 100644 (file)
@@ -221,7 +221,7 @@ class IMP_Imap_Tree
             }
 
             if (empty(self::$_instance)) {
-                self::$_instance = new IMP_Imap_Tree();
+                self::$_instance = new self();
             }
         }
 
index 338eabc..9236877 100644 (file)
@@ -84,7 +84,7 @@ class IMP_Mailbox
     static public function singleton($mailbox, $uid = null)
     {
         if (!isset(self::$_instances[$mailbox])) {
-            self::$_instances[$mailbox] = new IMP_Mailbox($mailbox, $uid);
+            self::$_instances[$mailbox] = new self($mailbox, $uid);
         } elseif (!is_null($uid)) {
             self::$_instances[$mailbox]->setIndex($uid);
         }
index 1195139..2beae88 100644 (file)
@@ -42,7 +42,7 @@ class IMP_Message
     public static function singleton()
     {
         if (!self::$_instance) {
-            self::$_instance = new IMP_Message();
+            self::$_instance = new self();
         }
 
         return self::$_instance;
index f5aeb5b..4aa7c7c 100644 (file)
@@ -68,7 +68,7 @@ class IMP_Quota
     static public function factory($driver, $params = array())
     {
         $driver = basename($driver);
-        $class = 'IMP_Quota_' . ucfirst($driver);
+        $class = __CLASS__ . '_' . ucfirst($driver);
 
         if (class_exists($class)) {
             return new $class($params);