| 1 | <?php |
||
| 5 | class BPClone |
||
| 6 | { |
||
| 7 | private $class; |
||
| 8 | private $clone = array(); |
||
| 9 | |||
| 10 | 1 | public function __construct($class = null) |
|
| 14 | |||
| 15 | 1 | public function __get($name) |
|
| 16 | { |
||
| 17 | 1 | $property = ($this->class) ? $this->class->$name : null; |
|
| 18 | 1 | if (is_object($property) || is_null($property)) { |
|
| 19 | if (!isset($this->clone[$name])) { |
||
| 20 | $this->clone[$name] = new BPClone($property); |
||
| 21 | } |
||
| 22 | |||
| 23 | return $this->clone[$name]; |
||
| 24 | } |
||
| 25 | |||
| 26 | 1 | return $property; |
|
| 27 | } |
||
| 28 | |||
| 29 | 1 | public function __call($name, $arguments) |
|
| 33 | } |
||
| 34 |