class config {
private $conf;
public function none_existent_method1(){
// forward the call to __call(__FUNCTION__, ...)
return call_user_func(array($this, '__call'),
__FUNCTION__, func_get_args());
}
public function none_existent_method2(){
// forward the call to __call(__FUNCTION__, ...)
return call_user_func(array($this, '__call'),
__FUNCTION__, func_get_args());
}
public function __call( $func, $args ){
if ( 0 == count($args) && isset($this->conf[$func]) ){
return $this->conf[$func];
}
else {
$this->conf[$func] = $args[0];
return $this;
}
}
}
Just add the methods and forward them to __call
yourself.
There are other ways but all require you declare the functions.