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; }
<?php error_reporting(E_ALL | E_STRICT); ini_set('display_errors', 1); require_once __DIR__ . '/../src/load.php'; em\Load::_([__DIR__ . '/../src/traits', __DIR__ . '/../src']); em\Park::log(['Passing in a %s.', 'directive']); em\Park::init(); em\Park::app(); em\Park::config(['myvar' => 'value']); em\Lang::_('en'); em\Park::err(em\Park::app()->myvar);