jenwachter
1/7/2014 - 1:47 PM

__get() and __call() methods

__get() and __call() methods

<?php

class SomeClass
{
    public function __get($prop)
    {
        if (property_exists($this->router, $prop)) {
            return $this->router->$prop;
        }
    }

    public function __call($method, $args)
    {
        if (method_exists($this->router, $method)) {
            return call_user_func_array(array($this->router, $method), $args);
        }
    }
}