public Collection<CompileFunctionSpec> getFunctionSpecs() {
        Map<String, CompileFunctionSpec> result = new HashMap<>();

        for (Method method : getClass().getDeclaredMethods()) {
            int mod = method.getModifiers();
            if (Modifier.isStatic(mod) && Modifier.isPublic(mod)) {
                String name = method.getName();
                Name altName = method.getAnnotation(Name.class);

                if (altName != null) {
                    name = altName.value();
                }

                CompileFunctionSpec function = result.get(name);

                if (function == null) {
                    result.put(name, function = new CompileFunctionSpec(name));
                }

                function.addMethod(method);
            }
        }

        for (Map.Entry<String, Method> item : getNativeFunctions().entrySet()) {
            Method method = item.getValue();
            CompileFunctionSpec function = new CompileFunctionSpec(item.getKey(), true);

            result.put(item.getKey(), function);

            function.addMethod(method);
        }

        return result.values();
    }
Use expectingReference(Environment env, TraceInfo trace, Memory memory, String funcName)
jphp-runtime/src/php/runtime/ext/support/compile/FunctionsContainer.java