Get Interceptor

class GetInterceptor{
public function __get($property){
$method = "get_{$property}";
if(method_exists($this,$method)) return $this->$method();
}
public function get_hello_text(){
return 'Hello';
}
}

$get_interceptor = new GetInterceptor();
echo $get_interceptor->hello_text;

0 Comments

You must be logged in to post a comment.