[ Index ] |
PHP Cross Reference of ACL Module |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * This class simply exists to get a more or less "good-style" way of hiding 4 * the actual used class. 5 * Downside: actually no parameters are accepted for the constructor :) 6 * The rest should be quite self-explanatory. 7 * 8 * All calls to this class will be redirected to the class pointed by $class 9 * @package acl.base 10 * @author dispy<dispyfree@googlemail.com> 11 * @license LGPLv2 12 */ 13 class HiddenClass{ 14 15 protected $class = NULL; 16 protected $obj = NULL; 17 18 public function __construct($className, $originalArguments){ 19 $this->class = $className; 20 $this->instantiateClass($originalArguments); 21 } 22 23 public function instantiateClass($arg){ 24 25 switch(count($arg)){ 26 case 0: 27 $this->obj = new $this->class(); 28 break; 29 case 1: 30 $this->obj = new $this->class($arg[0]); 31 break; 32 case 2: 33 $this->obj = new $this->class($arg[1]); 34 break; 35 case 3: 36 $this->obj = new $this->class($arg[2]); 37 break; 38 default: 39 throw new RuntimeException('Please expand this function yourself :)'); 40 break; 41 } 42 } 43 44 public function pretends(){ 45 return $this->class; 46 } 47 48 public function __call($funcName, $args){ 49 return call_user_func_array(array($this->obj, $funcName), $args); 50 } 51 52 public function __get($name) { 53 return $this->obj->{$name}; 54 } 55 56 public function __set($key, $val){ 57 return $this->obj->{$key} = $val; 58 } 59 60 public function __isset($key){ 61 return isset($this->obj->{$key}); 62 } 63 64 public function __unset($key){ 65 return $this->obj->{$key}; 66 } 67 68 } 69 70 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Jul 1 19:24:45 2012 | Cross-referenced by PHPXref 0.7.1 |