| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 10 /** 11 * class WactArrayObject. 12 * 13 * @package wact 14 * @version $Id: WactArrayObject.class.php 5945 2007-06-06 08:31:43Z pachanga $ 15 */ 16 class WactArrayObject implements ArrayAccess 17 { 18 /** 19 * @var ArrayAccess 20 */ 21 protected $innerObject; 22 23 protected $use_getter; 24 25 /** 26 * @param $object ArrayAccess/array 27 */ 28 public function __construct($object = array()) 29 { 30 if(is_object($object)) 31 { 32 $this->innerObject = $object; 33 $this->use_getter = method_exists($object, 'get'); 34 return; 35 } 36 37 if(is_null($object) || is_scalar($object)) 38 $object = array(); 39 40 $this->innerObject = $object; 41 } 42 43 function getInnerObject() 44 { 45 return $this->innerObject; 46 } 47 48 function offsetGet($key) 49 { 50 return $this->get($key); 51 } 52 53 function offsetSet($key, $value) 54 { 55 return $this->set($key, $value); 56 } 57 58 function offsetUnset($key) 59 { 60 unset($this->innerObject[$key]); 61 } 62 63 function offsetExists($key) 64 { 65 return isset($this->innerObject[$key]); 66 } 67 68 function export() 69 { 70 if(is_array($this->innerObject)) 71 return $this->innerObject; 72 if(method_exists($this->innerObject, 'export')) 73 return $this->innerObject->export(); 74 elseif(method_exists($this->innerObject, 'getArrayCopy')) 75 return $this->innerObject->getArrayCopy(); 76 } 77 78 function get($name) 79 { 80 if($this->use_getter) 81 return $this->innerObject->get($name); 82 else 83 { 84 if(isset($this->innerObject[$name])) 85 return $this->innerObject[$name]; 86 else 87 return NULL; 88 } 89 } 90 91 function set($name, $value) 92 { 93 if($this->use_getter) 94 return $this->innerObject->set($name, $value); 95 96 return $this->innerObject[$name] = $value; 97 } 98 99 function __call($methodName, $arguments) 100 { 101 return call_user_func_array(array($this->innerObject, $methodName), $arguments); 102 } 103 } 104 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Dec 1 03:56:46 2008 | Cross-referenced by PHPXref 0.7 |