From 4ba825f2285373c8a445c5945f7a8dd677a29875 Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Sun, 18 Oct 2009 21:23:23 -0400 Subject: [PATCH] Tweak a few php 5 things and make sure driver names are ucfirst --- framework/Lock/lib/Horde/Lock.php | 12 +++++------- framework/Lock/lib/Horde/Lock/Exception.php | 7 ------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/framework/Lock/lib/Horde/Lock.php b/framework/Lock/lib/Horde/Lock.php index 3178b8be2..6f6c06527 100644 --- a/framework/Lock/lib/Horde/Lock.php +++ b/framework/Lock/lib/Horde/Lock.php @@ -157,15 +157,15 @@ class Horde_Lock * @return Horde_Lock The newly created concrete Lock instance. * @throws Horde_Log_Exception */ - public function factory($driver, $params = null) + public static function factory($driver, $params = null) { if (is_array($driver)) { $app = $driver[0]; $driver = $driver[1]; } - $driver = basename($driver); - if (empty($driver) || ($driver == 'none')) { + $driver = ucfirst(basename($driver)); + if (empty($driver) || ($driver == 'None')) { return new Horde_Lock(); } @@ -205,8 +205,6 @@ class Horde_Lock * This should be used if multiple authentication sources (and, thus, * multiple Horde_Lock instances) are required. * - * This method must be invoked as: $var = &Horde_Lock::singleton() - * * @param string $driver The type of concrete Horde_Lock subclass to * return. * This is based on the storage driver ($driver). @@ -217,7 +215,7 @@ class Horde_Lock * @return Horde_Lock The concrete Horde_Lock reference * @throws Horde_Log_Exception */ - public function &singleton($driver, $params = null) + public static function singleton($driver, $params = null) { static $instances = array(); @@ -228,7 +226,7 @@ class Horde_Lock $signature = serialize(array($driver, $params)); if (empty($instances[$signature])) { - $instances[$signature] = Horde_Lock::factory($driver, $params); + $instances[$signature] = self::factory($driver, $params); } return $instances[$signature]; diff --git a/framework/Lock/lib/Horde/Lock/Exception.php b/framework/Lock/lib/Horde/Lock/Exception.php index 5d8c12c2e..2fe1b4a21 100644 --- a/framework/Lock/lib/Horde/Lock/Exception.php +++ b/framework/Lock/lib/Horde/Lock/Exception.php @@ -1,11 +1,4 @@