1: <?php
2: /**
3: * This set of classes implements a Flyweight pattern
4: * (http://en.wikipedia.org/wiki/Flyweight_pattern). Refactor/rename
5: * some based on this fact?
6: *
7: * @package Lens
8: */
9:
10: /**
11: * @package Lens
12: */
13: class Horde_Lens implements Horde_Lens_Interface {
14:
15: /**
16: */
17: protected $_target;
18:
19: /**
20: */
21: public function decorate($target)
22: {
23: $this->_target = $target;
24: return $this;
25: }
26:
27: /**
28: */
29: public function __get($key)
30: {
31: return $this->_target->$key;
32: }
33:
34: /**
35: */
36: public function __set($key, $value)
37: {
38: $this->_target->$key = $value;
39: return $this;
40: }
41:
42: /**
43: */
44: public function __call($func, $params)
45: {
46: return call_user_func_array(array($this->_target, $func), $params);
47: }
48:
49: }
50: