- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
/**
* Experiments...
*/
class poltergeist {
private $className;
private $methods;
function __construct() {
$this->className=array(
'page',
'source',
'user',
// etc
);
foreach ($this->className as $v) {
$this->$v = new $v();
$this->methods[$v] = get_class_methods($v);
}
}
function __call($name, $arg){
if ( ($k=$this->arraySearch( $name )) ) {
return $this->$k->$name($arg);
}
}
function arraySearch( $name ){
foreach ( $this->methods as $k=>$v ) {
if ( in_array( $name, $v) ) return $k;
}
return false;
}
}