CHAPTER 4 – Reflection API

4.5.2 Reflection API The reflection API consists of numerous classes that you can use to introspect your application.The following is a list of these items. The next section gives examples of how to use them. interface Reflector static export(...) class ReflectionFunction implements Reflector __construct(string $name) string __toString() static mixed export(string $name [,bool $return = false]) bool isInternal() bool isUserDefined() string getName() string getFileName() int getStartLine() int getEndLine() string getDocComment() mixed[] getStaticVariables() mixed invoke(mixed arg0, mixed arg1, ...) bool returnsReference() ReflectionParameter[] getParameters() class ReflectionMethod extends ReflectionFunction implements Reflector bool isPublic() bool isPrivate() bool isProtected() bool isAbstract() bool isFinal() bool isStatic() bool isConstructor() bool isDestructor() int getModifiers() ReflectionClass getDeclaringClass() class ReflectionClass implements Reflector string __toString() static mixed export(string $name [,bool $return = false]) string getName() bool isInternal() bool isUserDefined() bool isInstantiable() string getFileName() int getStartLine() int getEndLine() string getDocComment() ReflectionMethod getConstructor() ReflectionMethod getMethod(string $name) ReflectionMethod[] getMethods(int $filter) ReflectionProperty getProperty(string $name) ReflectionProperty[] getProperties(int $filter) mixed[] getConstants() mixed getConstant(string $name) ReflectionClass[] getInterfaces() bool isInterface() bool isAbstract() bool isFinal() int getModifiers() bool isInstance($obj) object newInstance(mixed arg0, arg1, ...) ReflectionClass getParentClass() bool isSubclassOf(string $class) bool isSubclassOf(ReflectionClass $class) mixed[] getStaticProperties() mixed[] getDefaultProperties() bool isIterateable() bool implementsInterface(string $ifc) bool implementsInterface(ReflectionClass $ifc) ReflectionExtension getExtension() string getExtensionName() class ReflectionParameter implements Reflector static mixed export(mixed func, int/string $param [,bool $return = false]) __construct(mixed func, int/string $param [,bool $return = false]) string __toString() string getName() bool isPassedByReference() ReflectionClass getClass() bool allowsNull() class ReflectionExtension implements Reflector static export(string $ext [,bool $return = false]) __construct(string $name) string __toString() string getName() string getVersion() ReflectionFunction[] getFunctions() mixed[] getConstants() mixed[] getINIEntries() ReflectionClass[] getClasses() String[] getClassNames() class ReflectionProperty implements Reflector static export(string/object $class, string $name, [,bool $return = false]) __construct(string/object $class, string $name) string getName() mixed getValue($object) setValue($object, mixed $value) bool isPublic() bool isPrivate() bool isProtected() bool isStatic() bool isDefault() int getModifiers() ReflectionClass getDeclaringClass() class Reflection static mixed export(Reflector $r [, bool $return = 0]) static array getModifierNames(int $modifier_value) class ReflectionException extends Exception

Post Comment
Login to post comments