Beware, the Reflection reflects only the information right after compile time based on the definitions, not based on runtime objects. Might be obvious, wasn't for me, until the app throws the exception at my head.
Example:
<?php
class A {
public $a = null;
function set() {
$this->foo = 'bar';
}
}
$a = new A;
$a->set();
// works fine
$Reflection = new ReflectionProperty($a, 'a');
// throws exception
$Reflection = new ReflectionProperty($a, 'foo');
?>
The ReflectionProperty class
Introduction
The ReflectionProperty class reports information about a classes properties.
Class synopsis
Properties
- name
-
Prop description
- class
-
Prop description
Predefined Constants
ReflectionProperty Node Types
- ReflectionProperty::IS_STATIC
-
Description here...
- ReflectionProperty::IS_PUBLIC
-
Description here...
- ReflectionProperty::IS_PROTECTED
-
Description here...
- ReflectionProperty::IS_PRIVATE
-
Description here...
Table of Contents
- ReflectionProperty::__clone — Clone
- ReflectionProperty::__construct — Construct a ReflectionProperty object
- ReflectionProperty::export — Export
- ReflectionProperty::getDeclaringClass — Gets declaring class
- ReflectionProperty::getDocComment — Gets doc comment
- ReflectionProperty::getModifiers — Gets modifiers
- ReflectionProperty::getName — Gets property name
- ReflectionProperty::getValue — Gets value
- ReflectionProperty::isDefault — Checks if default value
- ReflectionProperty::isPrivate — Checks if property is private
- ReflectionProperty::isProtected — Checks if property is protected
- ReflectionProperty::isPublic — Checks if property is public
- ReflectionProperty::isStatic — Checks if property is static
- ReflectionProperty::setAccessible — Set property accessibility
- ReflectionProperty::setValue — Set property value
- ReflectionProperty::__toString — To string
ReflectionProperty
CodeDuck at gmx dot net
08-Feb-2006 04:07
08-Feb-2006 04:07
