1 <?php 2 /** 3 * Provides a wrapper around an object to return null for non-existent 4 * properties (instead of throwing an error). 5 * 6 * Copyright 2012-2017 Horde LLC (http://www.horde.org/) 7 * 8 * @author Michael Slusarz <slusarz@horde.org> 9 * @category Horde 10 * @license http://www.horde.org/licenses/bsd BSD 11 * @package Support 12 */ 13 14 /** 15 * @author Michael Slusarz <slusarz@horde.org> 16 * @category Horde 17 * @license http://www.horde.org/licenses/bsd BSD 18 * @package Support 19 */ 20 class Horde_Support_ObjectStub 21 { 22 /** 23 * Original data object. 24 * 25 * @var array 26 */ 27 protected $_data; 28 29 /** 30 * Constructor 31 * 32 * @param object $data The original data object. 33 */ 34 public function __construct($data) 35 { 36 $this->_data = $data; 37 } 38 39 /** 40 */ 41 public function __get($name) 42 { 43 return isset($this->_data->$name) 44 ? $this->_data->$name 45 : null; 46 } 47 48 /** 49 */ 50 public function __set($name, $value) 51 { 52 $this->_data->$name = $value; 53 } 54 55 /** 56 */ 57 public function __isset($name) 58 { 59 return isset($this->_data->$name); 60 } 61 62 /** 63 */ 64 public function __unset($name) 65 { 66 unset($this->_data->$name); 67 } 68 69 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body