public function decorate($parent)
{
$this->_parent = $parent;
// Lock down attributes to what is defined in the class
// and speed up references in magic methods
$class_name = get_class($parent);
if (!isset(self::$_reflections[$class_name])) {
$r = new ReflectionObject($parent);
foreach ($r->getMethods() as $method) {
if ($method->isPublic()) {
$this->_methods[] = $method->getName();
}
}
foreach ($r->getProperties() as $prop) {
if ($prop->isPublic()) {
$this->_properties[] = $prop->getName();
}
}
self::$_reflections[$class_name] = array($this->_methods, $this->_properties);
} else {
list($this->_methods, $this->_properties) = self::$_reflections[$class_name];
}
}