diff options
author | Pascal Kriete <pascal.kriete@ellislab.com> | 2010-11-04 22:59:52 +0100 |
---|---|---|
committer | Pascal Kriete <pascal.kriete@ellislab.com> | 2010-11-04 22:59:52 +0100 |
commit | e917f9be8b05c81357c1c2c9730d5060685d644d (patch) | |
tree | b6a7d5ce8ba57b69ba61454f77829b04f2ce5974 /system/libraries/Driver.php | |
parent | 5b2d2da5ae2e97043c6bef53e565d30e50196e2b (diff) | |
parent | e1f6e9ddff788f6a154f5f35dc117d14aeb0c484 (diff) |
Automated merge with http://hg.ellislab.com/CodeIgniter2
Diffstat (limited to 'system/libraries/Driver.php')
-rw-r--r-- | system/libraries/Driver.php | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index 07ef2e724..1261b4c72 100644 --- a/system/libraries/Driver.php +++ b/system/libraries/Driver.php @@ -25,25 +25,25 @@ * @subpackage Libraries * @category Libraries * @author EllisLab Dev Team - * @link + * @link */ class CI_Driver_Library { protected $valid_drivers = array(); protected static $lib_name; - + // The first time a child is used it won't exist, so we instantiate it // subsequents calls will go straight to the proper child. function __get($child) { if (! isset($this->lib_name)) { - $this->lib_name = get_class($this); + $this->lib_name = get_class($this); } // The class will be prefixed with the parent lib $child_class = $this->lib_name.'_'.$child; - + if (in_array(strtolower($child_class), array_map('strtolower', $this->valid_drivers))) { // check and see if the driver is in a separate file @@ -64,11 +64,11 @@ class CI_Driver_Library { { include_once $filepath; break; - } + } } } } - + // it's a valid driver, but the file simply can't be found if ( ! class_exists($child_class)) { @@ -82,14 +82,14 @@ class CI_Driver_Library { $this->$child = $obj; return $this->$child; } - + // The requested driver isn't valid! log_message('error', "Invalid driver requested: ".$child_class); show_error("Invalid driver requested: ".$child_class); } - + // -------------------------------------------------------------------- - + } // END CI_Driver_Library CLASS @@ -104,11 +104,11 @@ class CI_Driver_Library { * @subpackage Libraries * @category Libraries * @author EllisLab Dev Team - * @link + * @link */ class CI_Driver { protected $parent; - + private $methods = array(); private $properties = array(); @@ -126,16 +126,16 @@ class CI_Driver { function decorate($parent) { $this->parent = $parent; - + // Lock down attributes to what is defined in the class // and speed up references in magic methods - + $class_name = get_class($parent); - + if ( ! isset(self::$reflections[$class_name])) { $r = new ReflectionObject($parent); - + foreach ($r->getMethods() as $method) { if ($method->isPublic()) @@ -151,7 +151,7 @@ class CI_Driver { $this->properties[] = $prop->getName(); } } - + self::$reflections[$class_name] = array($this->methods, $this->properties); } else @@ -159,9 +159,9 @@ class CI_Driver { list($this->methods, $this->properties) = self::$reflections[$class_name]; } } - + // -------------------------------------------------------------------- - + /** * __call magic method * @@ -185,7 +185,7 @@ class CI_Driver { } // -------------------------------------------------------------------- - + /** * __get magic method * @@ -204,7 +204,7 @@ class CI_Driver { } // -------------------------------------------------------------------- - + /** * __set magic method * @@ -222,9 +222,9 @@ class CI_Driver { $this->parent->$var = $val; } } - + // -------------------------------------------------------------------- - + } // END CI_Driver CLASS |