use of php.runtime.memory.ObjectMemory 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;
}
use of php.runtime.memory.ObjectMemory in project jphp by jphp-compiler.
the class ReflectionFunctionAbstract method getExtension.
@Signature
public Memory getExtension(Environment env, Memory... args) {
if (getClosureEntity() != null)
return Memory.NULL;
Extension extension = getEntity().getExtension();
if (extension == null)
return Memory.NULL;
else {
ReflectionExtension ext = new ReflectionExtension(env, env.fetchClass("ReflectionExtension"));
ext.setExtension(extension);
return new ObjectMemory(ext);
}
}
use of php.runtime.memory.ObjectMemory in project jphp by jphp-compiler.
the class ReflectionMethod method getPrototype.
@Signature
public Memory getPrototype(Environment env, Memory... args) {
if (methodEntity.getPrototype() == null)
return Memory.NULL;
ClassEntity classEntity = env.fetchClass("ReflectionMethod");
ReflectionMethod r = new ReflectionMethod(env, classEntity);
r.setEntity(methodEntity.getPrototype());
return new ObjectMemory(r);
}
use of php.runtime.memory.ObjectMemory in project jphp by jphp-compiler.
the class ReflectionMethod method getParameters.
@Override
@Signature
public Memory getParameters(Environment env, Memory... args) {
if (cachedParameters != null)
return cachedParameters;
ParameterEntity[] parameters = methodEntity.getParameters(Integer.MAX_VALUE);
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(methodEntity);
e.setPosition(i);
i++;
result.add(new ObjectMemory(e));
}
return cachedParameters = result;
}
use of php.runtime.memory.ObjectMemory in project jphp by jphp-compiler.
the class ReflectionClass method getProperties.
@Signature(@Arg(value = "filter", optional = @Optional("NULL")))
public Memory getProperties(Environment env, Memory... args) {
int mod = args[0].isNull() ? -1 : args[0].toInteger();
ArrayMemory result = new ArrayMemory();
ClassEntity classEntity = env.fetchClass("ReflectionProperty");
if (mod == -1 || (mod & ReflectionProperty.IS_STATIC) == ReflectionProperty.IS_STATIC) {
for (PropertyEntity e : entity.getStaticProperties()) {
ReflectionProperty prop = new ReflectionProperty(env, classEntity);
prop.setEntity(e);
result.add(new ObjectMemory(prop));
}
}
for (PropertyEntity e : entity.getProperties()) {
if (checkModifiers(e, mod)) {
ReflectionProperty prop = new ReflectionProperty(env, classEntity);
prop.setEntity(e);
result.add(new ObjectMemory(prop));
}
}
return result.toConstant();
}
Aggregations