Andrey Andreev | c5536aa | 2012-11-01 17:33:58 +0200 | [diff] [blame] | 1 | <?php |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 2 | /** |
| 3 | * CodeIgniter |
| 4 | * |
Phil Sturgeon | 07c1ac8 | 2012-03-09 17:03:37 +0000 | [diff] [blame] | 5 | * An open source application development framework for PHP 5.2.4 or newer |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 6 | * |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 7 | * NOTICE OF LICENSE |
Andrey Andreev | 83d1505 | 2011-12-22 13:35:42 +0200 | [diff] [blame] | 8 | * |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 9 | * Licensed under the Open Software License version 3.0 |
Andrey Andreev | 83d1505 | 2011-12-22 13:35:42 +0200 | [diff] [blame] | 10 | * |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 11 | * This source file is subject to the Open Software License (OSL 3.0) that is |
| 12 | * bundled with this package in the files license.txt / license.rst. It is |
| 13 | * also available through the world wide web at this URL: |
| 14 | * http://opensource.org/licenses/OSL-3.0 |
| 15 | * If you did not receive a copy of the license and are unable to obtain it |
| 16 | * through the world wide web, please send an email to |
| 17 | * licensing@ellislab.com so we can send you a copy immediately. |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 18 | * |
| 19 | * @package CodeIgniter |
| 20 | * @author EllisLab Dev Team |
Greg Aker | 0defe5d | 2012-01-01 18:46:41 -0600 | [diff] [blame] | 21 | * @copyright Copyright (c) 2006 - 2012, EllisLab, Inc. (http://ellislab.com/) |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 22 | * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 23 | * @link http://codeigniter.com |
| 24 | * @since Version 1.0 |
| 25 | * @filesource |
| 26 | */ |
Andrey Andreev | c5536aa | 2012-11-01 17:33:58 +0200 | [diff] [blame] | 27 | defined('BASEPATH') OR exit('No direct script access allowed'); |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 28 | |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 29 | /** |
| 30 | * CodeIgniter Driver Library Class |
| 31 | * |
| 32 | * This class enables you to create "Driver" libraries that add runtime ability |
| 33 | * to extend the capabilities of a class via additional driver objects |
| 34 | * |
| 35 | * @package CodeIgniter |
| 36 | * @subpackage Libraries |
| 37 | * @category Libraries |
| 38 | * @author EllisLab Dev Team |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 39 | * @link |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 40 | */ |
| 41 | class CI_Driver_Library { |
| 42 | |
Timothy Warren | 0688ac9 | 2012-04-20 10:25:04 -0400 | [diff] [blame] | 43 | /** |
| 44 | * Array of drivers that are available to use with the driver class |
| 45 | * |
| 46 | * @var array |
| 47 | */ |
| 48 | protected $valid_drivers = array(); |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 49 | |
Timothy Warren | 0688ac9 | 2012-04-20 10:25:04 -0400 | [diff] [blame] | 50 | /** |
| 51 | * Name of the current class - usually the driver class |
| 52 | * |
| 53 | * @var string |
| 54 | */ |
Darren Hill | c4e266b | 2011-08-30 15:40:27 -0400 | [diff] [blame] | 55 | protected $lib_name; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 56 | |
Darren Hill | 6fbf6bd | 2011-08-31 14:15:35 -0400 | [diff] [blame] | 57 | /** |
| 58 | * Get magic method |
| 59 | * |
Darren Hill | c4e266b | 2011-08-30 15:40:27 -0400 | [diff] [blame] | 60 | * The first time a child is used it won't exist, so we instantiate it |
| 61 | * subsequents calls will go straight to the proper child. |
Darren Hill | 6fbf6bd | 2011-08-31 14:15:35 -0400 | [diff] [blame] | 62 | * |
dchill42 | 6262d05 | 2012-11-24 18:41:13 -0500 | [diff] [blame^] | 63 | * @param string Child class name |
| 64 | * @return object Child class |
Darren Hill | 6fbf6bd | 2011-08-31 14:15:35 -0400 | [diff] [blame] | 65 | */ |
Darren Hill | c4e266b | 2011-08-30 15:40:27 -0400 | [diff] [blame] | 66 | public function __get($child) |
Andrey Andreev | 2e3e230 | 2012-10-09 15:52:34 +0300 | [diff] [blame] | 67 | { |
Darren Hill | 6fbf6bd | 2011-08-31 14:15:35 -0400 | [diff] [blame] | 68 | // Try to load the driver |
dchill42 | c587225 | 2012-07-30 14:53:11 -0400 | [diff] [blame] | 69 | return $this->load_driver($child); |
Darren Hill | 6fbf6bd | 2011-08-31 14:15:35 -0400 | [diff] [blame] | 70 | } |
Darren Hill | c4e266b | 2011-08-30 15:40:27 -0400 | [diff] [blame] | 71 | |
Darren Hill | 6fbf6bd | 2011-08-31 14:15:35 -0400 | [diff] [blame] | 72 | /** |
| 73 | * Load driver |
| 74 | * |
Darren Hill | c4e266b | 2011-08-30 15:40:27 -0400 | [diff] [blame] | 75 | * Separate load_driver call to support explicit driver load by library or user |
Darren Hill | 6fbf6bd | 2011-08-31 14:15:35 -0400 | [diff] [blame] | 76 | * |
dchill42 | 6262d05 | 2012-11-24 18:41:13 -0500 | [diff] [blame^] | 77 | * @param string Driver name (w/o parent prefix) |
| 78 | * @return object Child class |
Darren Hill | 6fbf6bd | 2011-08-31 14:15:35 -0400 | [diff] [blame] | 79 | */ |
Darren Hill | c4e266b | 2011-08-30 15:40:27 -0400 | [diff] [blame] | 80 | public function load_driver($child) |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 81 | { |
dchill42 | 6262d05 | 2012-11-24 18:41:13 -0500 | [diff] [blame^] | 82 | // Get CodeIgniter instance and subclass prefix |
| 83 | $CI = get_instance(); |
| 84 | $prefix = (string) $CI->config->item('subclass_prefix'); |
| 85 | |
Pascal Kriete | 14287f3 | 2011-02-14 13:39:34 -0500 | [diff] [blame] | 86 | if ( ! isset($this->lib_name)) |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 87 | { |
dchill42 | 6262d05 | 2012-11-24 18:41:13 -0500 | [diff] [blame^] | 88 | // Get library name without any prefix |
| 89 | $this->lib_name = str_replace(array('CI_', $prefix), '', get_class($this)); |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 90 | } |
| 91 | |
dchill42 | 6262d05 | 2012-11-24 18:41:13 -0500 | [diff] [blame^] | 92 | // The child will be prefixed with the parent lib |
| 93 | $child_name = $this->lib_name.'_'.$child; |
Andrey Andreev | 83d1505 | 2011-12-22 13:35:42 +0200 | [diff] [blame] | 94 | |
dchill42 | 6262d05 | 2012-11-24 18:41:13 -0500 | [diff] [blame^] | 95 | // See if requested child is a valid driver |
| 96 | if ( ! in_array($child, array_map('strtolower', $this->valid_drivers))) |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 97 | { |
dchill42 | 6262d05 | 2012-11-24 18:41:13 -0500 | [diff] [blame^] | 98 | // The requested driver isn't valid! |
| 99 | $msg = 'Invalid driver requested: '.$child_name; |
| 100 | log_message('error', $msg); |
| 101 | show_error($msg); |
| 102 | } |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 103 | |
dchill42 | 6262d05 | 2012-11-24 18:41:13 -0500 | [diff] [blame^] | 104 | // All driver files should be in a library subdirectory - capitalized |
| 105 | $subdir = ucfirst(strtolower($this->lib_name)); |
| 106 | |
| 107 | // Get package paths and filename case variations to search |
| 108 | $paths = $CI->load->get_package_paths(TRUE); |
| 109 | $cases = array(ucfirst($child_name), strtolower($child_name)); |
| 110 | |
| 111 | // Is there an extension? |
| 112 | $class_name = $prefix.$child_name; |
| 113 | $found = class_exists($class_name); |
| 114 | if ( ! $found) |
| 115 | { |
| 116 | // Check for subclass file |
| 117 | foreach ($paths as $path) |
| 118 | { |
| 119 | // Extension will be in drivers subdirectory |
| 120 | $path .= 'libraries/'.$subdir.'/drivers/'; |
| 121 | |
| 122 | // Try filename with caps and all lowercase |
| 123 | foreach ($cases as $name) |
| 124 | { |
| 125 | // Does the file exist? |
| 126 | $file = $path.$prefix.$name.'.php'; |
| 127 | if (file_exists($file)) |
| 128 | { |
| 129 | // Yes - require base class from BASEPATH |
| 130 | $basepath = BASEPATH.'libraries/'.$subdir.'/drivers/'.ucfirst($child_name).'.php'; |
| 131 | if ( ! file_exists($basepath)) |
Phil Sturgeon | eb2dcda | 2011-04-02 14:44:58 +0100 | [diff] [blame] | 132 | { |
dchill42 | 6262d05 | 2012-11-24 18:41:13 -0500 | [diff] [blame^] | 133 | $msg = 'Unable to load the requested class: CI_'.$child_name; |
| 134 | log_message('error', $msg); |
| 135 | show_error($msg); |
| 136 | } |
| 137 | |
| 138 | // Include both sources and mark found |
| 139 | include($basepath); |
| 140 | include($file); |
| 141 | $found = TRUE; |
| 142 | break 2; |
| 143 | } |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | // Do we need to search for the class? |
| 149 | if ( ! $found) |
| 150 | { |
| 151 | // Use standard class name |
| 152 | $class_name = 'CI_'.$child_name; |
| 153 | $found = class_exists($class_name); |
| 154 | if ( ! $found) |
| 155 | { |
| 156 | // Check package paths |
| 157 | foreach ($paths as $path) |
| 158 | { |
| 159 | // Class will be in drivers subdirectory |
| 160 | $path .= 'libraries/'.$subdir.'/drivers/'; |
| 161 | |
| 162 | // Try filename with caps and all lowercase |
| 163 | foreach ($cases as $name) |
| 164 | { |
| 165 | // Does the file exist? |
| 166 | $file = $path.$name.'.php'; |
| 167 | if (file_exists($file)) |
| 168 | { |
| 169 | // Include source |
| 170 | include($file); |
Darren Hill | c4e266b | 2011-08-30 15:40:27 -0400 | [diff] [blame] | 171 | break 2; |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 172 | } |
| 173 | } |
| 174 | } |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 175 | } |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 176 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 177 | |
dchill42 | 6262d05 | 2012-11-24 18:41:13 -0500 | [diff] [blame^] | 178 | // Did we finally find the class? |
| 179 | if ( ! class_exists($class_name)) |
| 180 | { |
| 181 | $msg = 'Unable to load the requested driver: '.$class_name; |
| 182 | log_message('error', $msg); |
| 183 | show_error($msg); |
| 184 | } |
| 185 | |
| 186 | // Instantiate, decorate, and add child |
| 187 | $obj = new $class_name; |
| 188 | $obj->decorate($this); |
| 189 | $this->$child = $obj; |
| 190 | return $this->$child; |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 191 | } |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 192 | |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 193 | } |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 194 | |
Timothy Warren | 0688ac9 | 2012-04-20 10:25:04 -0400 | [diff] [blame] | 195 | // -------------------------------------------------------------------------- |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 196 | |
| 197 | /** |
| 198 | * CodeIgniter Driver Class |
| 199 | * |
| 200 | * This class enables you to create drivers for a Library based on the Driver Library. |
| 201 | * It handles the drivers' access to the parent library |
| 202 | * |
| 203 | * @package CodeIgniter |
| 204 | * @subpackage Libraries |
| 205 | * @category Libraries |
| 206 | * @author EllisLab Dev Team |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 207 | * @link |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 208 | */ |
| 209 | class CI_Driver { |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 210 | |
Timothy Warren | 0688ac9 | 2012-04-20 10:25:04 -0400 | [diff] [blame] | 211 | /** |
| 212 | * Instance of the parent class |
| 213 | * |
| 214 | * @var object |
| 215 | */ |
Andrey Andreev | 8486e9c | 2012-03-26 20:24:12 +0300 | [diff] [blame] | 216 | protected $_parent; |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 217 | |
Timothy Warren | 0688ac9 | 2012-04-20 10:25:04 -0400 | [diff] [blame] | 218 | /** |
| 219 | * List of methods in the parent class |
| 220 | * |
| 221 | * @var array |
| 222 | */ |
Andrey Andreev | 8486e9c | 2012-03-26 20:24:12 +0300 | [diff] [blame] | 223 | protected $_methods = array(); |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 224 | |
Timothy Warren | 0688ac9 | 2012-04-20 10:25:04 -0400 | [diff] [blame] | 225 | /** |
| 226 | * List of properties in the parent class |
| 227 | * |
| 228 | * @var array |
| 229 | */ |
Andrey Andreev | 8486e9c | 2012-03-26 20:24:12 +0300 | [diff] [blame] | 230 | protected $_properties = array(); |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 231 | |
Timothy Warren | 0688ac9 | 2012-04-20 10:25:04 -0400 | [diff] [blame] | 232 | /** |
| 233 | * Array of methods and properties for the parent class(es) |
| 234 | * |
Andrey Andreev | 5fd3ae8 | 2012-10-24 14:55:35 +0300 | [diff] [blame] | 235 | * @static |
| 236 | * @var array |
Timothy Warren | 0688ac9 | 2012-04-20 10:25:04 -0400 | [diff] [blame] | 237 | */ |
Andrey Andreev | 8486e9c | 2012-03-26 20:24:12 +0300 | [diff] [blame] | 238 | protected static $_reflections = array(); |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 239 | |
| 240 | /** |
| 241 | * Decorate |
| 242 | * |
| 243 | * Decorates the child with the parent driver lib's methods and properties |
| 244 | * |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 245 | * @param object |
| 246 | * @return void |
| 247 | */ |
Greg Aker | a926328 | 2010-11-10 15:26:43 -0600 | [diff] [blame] | 248 | public function decorate($parent) |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 249 | { |
Andrey Andreev | 8486e9c | 2012-03-26 20:24:12 +0300 | [diff] [blame] | 250 | $this->_parent = $parent; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 251 | |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 252 | // Lock down attributes to what is defined in the class |
| 253 | // and speed up references in magic methods |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 254 | |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 255 | $class_name = get_class($parent); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 256 | |
Andrey Andreev | 8486e9c | 2012-03-26 20:24:12 +0300 | [diff] [blame] | 257 | if ( ! isset(self::$_reflections[$class_name])) |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 258 | { |
| 259 | $r = new ReflectionObject($parent); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 260 | |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 261 | foreach ($r->getMethods() as $method) |
| 262 | { |
| 263 | if ($method->isPublic()) |
| 264 | { |
Andrey Andreev | 8486e9c | 2012-03-26 20:24:12 +0300 | [diff] [blame] | 265 | $this->_methods[] = $method->getName(); |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 266 | } |
| 267 | } |
| 268 | |
Pascal Kriete | 14287f3 | 2011-02-14 13:39:34 -0500 | [diff] [blame] | 269 | foreach ($r->getProperties() as $prop) |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 270 | { |
| 271 | if ($prop->isPublic()) |
| 272 | { |
Andrey Andreev | 8486e9c | 2012-03-26 20:24:12 +0300 | [diff] [blame] | 273 | $this->_properties[] = $prop->getName(); |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 274 | } |
| 275 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 276 | |
Andrey Andreev | 8486e9c | 2012-03-26 20:24:12 +0300 | [diff] [blame] | 277 | self::$_reflections[$class_name] = array($this->_methods, $this->_properties); |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 278 | } |
| 279 | else |
| 280 | { |
Andrey Andreev | 8486e9c | 2012-03-26 20:24:12 +0300 | [diff] [blame] | 281 | list($this->_methods, $this->_properties) = self::$_reflections[$class_name]; |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 282 | } |
| 283 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 284 | |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 285 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 286 | |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 287 | /** |
| 288 | * __call magic method |
| 289 | * |
| 290 | * Handles access to the parent driver library's methods |
| 291 | * |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 292 | * @param string |
| 293 | * @param array |
| 294 | * @return mixed |
| 295 | */ |
| 296 | public function __call($method, $args = array()) |
| 297 | { |
Andrey Andreev | 8486e9c | 2012-03-26 20:24:12 +0300 | [diff] [blame] | 298 | if (in_array($method, $this->_methods)) |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 299 | { |
Andrey Andreev | 8486e9c | 2012-03-26 20:24:12 +0300 | [diff] [blame] | 300 | return call_user_func_array(array($this->_parent, $method), $args); |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 301 | } |
| 302 | |
| 303 | $trace = debug_backtrace(); |
| 304 | _exception_handler(E_ERROR, "No such method '{$method}'", $trace[1]['file'], $trace[1]['line']); |
| 305 | exit; |
| 306 | } |
| 307 | |
| 308 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 309 | |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 310 | /** |
| 311 | * __get magic method |
| 312 | * |
| 313 | * Handles reading of the parent driver library's properties |
| 314 | * |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 315 | * @param string |
| 316 | * @return mixed |
| 317 | */ |
Greg Aker | a926328 | 2010-11-10 15:26:43 -0600 | [diff] [blame] | 318 | public function __get($var) |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 319 | { |
Andrey Andreev | 8486e9c | 2012-03-26 20:24:12 +0300 | [diff] [blame] | 320 | if (in_array($var, $this->_properties)) |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 321 | { |
Andrey Andreev | 8486e9c | 2012-03-26 20:24:12 +0300 | [diff] [blame] | 322 | return $this->_parent->$var; |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 323 | } |
| 324 | } |
| 325 | |
| 326 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 327 | |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 328 | /** |
| 329 | * __set magic method |
| 330 | * |
| 331 | * Handles writing to the parent driver library's properties |
| 332 | * |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 333 | * @param string |
| 334 | * @param array |
| 335 | * @return mixed |
| 336 | */ |
Greg Aker | a926328 | 2010-11-10 15:26:43 -0600 | [diff] [blame] | 337 | public function __set($var, $val) |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 338 | { |
Andrey Andreev | 8486e9c | 2012-03-26 20:24:12 +0300 | [diff] [blame] | 339 | if (in_array($var, $this->_properties)) |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 340 | { |
Andrey Andreev | 8486e9c | 2012-03-26 20:24:12 +0300 | [diff] [blame] | 341 | $this->_parent->$var = $val; |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 342 | } |
| 343 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 344 | |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 345 | } |
Derek Jones | 8dca041 | 2010-03-05 13:01:44 -0600 | [diff] [blame] | 346 | |
| 347 | /* End of file Driver.php */ |
Andrey Andreev | 2e3e230 | 2012-10-09 15:52:34 +0300 | [diff] [blame] | 348 | /* Location: ./system/libraries/Driver.php */ |