decorator and method_exists
<p>I have the following code; what should be added to the decorator class to pass the check of <code>method_exists()</code>? In real task I can't change the function that calls <code>method_exists()</code>.<br>
Also any idea how to cheat 'get_class_methods()' and  'get_class_vars()'?</p>

<pre><code>class real {
    function __construct($arg1,$arg2)
    {

    }

    function test()
    {
        echo "test output\n";
    }
}

class decorator
{
    protected $real;

    function __construct()
    {
        eval('$this-&gt;real=new real('.implode(',',func_get_args()).');');
    }

    function __call($method,$args)
    {
        echo "called $method\n";
        $ret=call_user_func_array(array($this-&gt;real, $method), $args);
        return $ret;
    }

    public function __isset($name)
    {
        echo "isset $name\n";
    }
}
//-----Can't change below
$r=new decorator(1,2);
if (!method_exists($r,'test')) {die ("method 'test' does not exist, Fail :(\n");}
echo $r-&gt;test();
</code></pre>

<p>Any ideas ? (I'm thinking of generating a wrapper class by eval())</p>
