private static function interfacePrep() { if (empty(static::$methods)) { $interface = new ReflectionObject(static::$wrapper); $methods = $interface->getMethods(); static::$methods = array_combine(array_map(function ($v) { return $v->getName(); }, $methods), $methods); } }
public static function registerHelper($context) { // Remove magic methods. $methods = array_filter(get_class_methods($context), function ($method) { return !preg_match('/^__/', $method); }); $methods = array_flip($methods); foreach ($methods as $method => $index) { $methods[$method] = $context; } // TODO Replace previous? Or not? static::$methods = array_merge(static::$methods, $methods); }