summaryrefslogtreecommitdiffstats
path: root/system/libraries/Driver.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries/Driver.php')
-rw-r--r--system/libraries/Driver.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php
index d67ee2549..769d892dc 100644
--- a/system/libraries/Driver.php
+++ b/system/libraries/Driver.php
@@ -54,14 +54,30 @@ class CI_Driver_Library {
protected $lib_name;
/**
+ * Get magic method
+ *
* The first time a child is used it won't exist, so we instantiate it
* subsequents calls will go straight to the proper child.
*
- * @param mixed $child
- * @return mixed
+ * @param string Child class name
+ * @return object Child class
*/
public function __get($child)
{
+ // Try to load the driver
+ return $this->load_driver($child);
+ }
+
+ /**
+ * Load driver
+ *
+ * Separate load_driver call to support explicit driver load by library or user
+ *
+ * @param string Child class name
+ * @return object Child class
+ */
+ public function load_driver($child)
+ {
if ( ! isset($this->lib_name))
{
$this->lib_name = get_class($this);