Array f_get_class_methods(CVarRef class_or_object) { if (hhvm) { const VM::Class* cls = get_cls(class_or_object); if (!cls) return Array(); VMRegAnchor _; HphpArray* retVal = NEW(HphpArray)(cls->numMethods()); cls->getMethodNames(arGetContextClassFromBuiltin(g_vmContext->getFP()), retVal); return Array(retVal).keys(); } ClassInfo::MethodVec methods; CStrRef class_name = get_classname(class_or_object); const ClassInfo *classInfo = NULL; for (int i = 0; ; ++i) { classInfo = ClassInfo::FindClassInterfaceOrTrait(class_name); if (classInfo) break; if (i) return Array(); AutoloadHandler::s_instance->invokeHandler(class_name); } if (!ClassInfo::GetClassMethods(methods, classInfo)) return Array(); CStrRef klass = ctxClassName(); bool allowPrivate = !klass.empty() && klass->isame(class_name.get()); Array ret = Array::Create(); for (unsigned int i = 0; i < methods.size(); i++) { if ((methods[i]->attribute & ClassInfo::IsPublic) || allowPrivate) { ret.set(methods[i]->name, true); } } return ret.keys(); }
Array f_get_class_methods(CVarRef class_or_object) { ClassInfo::MethodVec methods; CStrRef class_name = get_classname(class_or_object); ClassInfo::GetClassMethods(methods, class_name); CStrRef klass = FrameInjection::GetClassName(true); bool allowPrivate = !klass.empty() && klass->isame(class_name.get()); Array ret = Array::Create(); for (unsigned int i = 0; i < methods.size(); i++) { if ((methods[i]->attribute & ClassInfo::IsPublic) || allowPrivate) { ret.set(methods[i]->name, true); } } return ret.keys(); }