public function __call($method, $args) { em\Park::run('before_' . $method); if (is_callable(array($this, $method)) && method_exists($this, $method)) { $return = call_user_func_array(array($this, $method), $args); } else { $subscriber = false; foreach (em\Park::$factories as $factory) { if (is_callable(array($this, $method)) && method_exists($factory, $method)) { if ($subscriber) { call_user_func_array(array($subscriber, $method), $args); } $subscriber = $factory; } } $return = call_user_func_array(array($subscriber, $method), $args); } em\Park::run('after_' . $method); return $return; }