use of php.runtime.reflection.CompileFunctionEntity in project jphp by jphp-compiler.
the class ReflectionFunction method getParameters.
@Override
@Signature
public Memory getParameters(Environment env, Memory... args) {
if (cachedParameters != null)
return cachedParameters;
if (functionEntity instanceof CompileFunctionEntity)
exception(env, "Cannot get parameters for internal function %s()", functionEntity.getName());
ParameterEntity[] parameters = closureEntity == null ? functionEntity.getParameters() : closureEntity.parameters;
ClassEntity entity = env.fetchClass("ReflectionParameter");
ArrayMemory result = new ArrayMemory();
int i = 0;
for (ParameterEntity param : parameters) {
ReflectionParameter e = new ReflectionParameter(env, entity);
e.setEntity(param);
e.setFunctionEntity(functionEntity);
e.setPosition(i);
i++;
result.add(new ObjectMemory(e));
}
return cachedParameters = result;
}
Aggregations