use of php.runtime.reflection.ClassEntity in project jphp by jphp-compiler.
the class WrapEnvironment method importClass.
@Signature(@Arg("className"))
public Memory importClass(Environment env, Memory... args) throws Throwable {
ClassEntity classEntity = env.fetchClass(args[0].toString());
if (classEntity == null) {
env.exception(Messages.ERR_CLASS_NOT_FOUND.fetch(args[0]));
return Memory.NULL;
}
environment.registerClass(classEntity);
return Memory.NULL;
}
use of php.runtime.reflection.ClassEntity 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();
}
use of php.runtime.reflection.ClassEntity in project jphp by jphp-compiler.
the class ReflectionClass method getProperty.
@Signature(@Arg("name"))
public Memory getProperty(Environment env, Memory... args) {
String name = args[0].toString();
PropertyEntity e = entity.findProperty(name);
if (e == null)
e = entity.findStaticProperty(name);
if (e == null)
return Memory.NULL;
ClassEntity classEntity = env.fetchClass("ReflectionProperty");
ReflectionProperty prop = new ReflectionProperty(env, classEntity);
prop.setEntity(e);
return new ObjectMemory(prop);
}
use of php.runtime.reflection.ClassEntity in project jphp by jphp-compiler.
the class ReflectionClass method getStaticProperties.
@Signature
public Memory getStaticProperties(Environment env, Memory... args) {
ArrayMemory result = new ArrayMemory();
ClassEntity classEntity = env.fetchClass("ReflectionProperty");
for (PropertyEntity e : entity.getStaticProperties()) {
ReflectionProperty prop = new ReflectionProperty(env, classEntity);
prop.setEntity(e);
result.add(new ObjectMemory(prop));
}
return result.toConstant();
}
use of php.runtime.reflection.ClassEntity in project jphp by jphp-compiler.
the class ReflectionClass method implementsInterface.
@Signature(@Arg("interface"))
public Memory implementsInterface(Environment env, Memory... args) {
String name = args[0].toString();
ClassEntity e = env.fetchClass(name, true);
if (!e.isInterface())
exception(env, "Interface %s is a Class", name);
if (!entity.isInstanceOf(e))
return Memory.FALSE;
return env.fetchClass(name).isInterface() ? Memory.TRUE : Memory.FALSE;
}
Aggregations