Simple class introspection using php's class functions. This generates a list of classes, and their members and methods.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <?php
// include some file that defines classes, such as PEAR's mail.php
require("Mail.php");
$classes = get_declared_classes();
foreach($classes as $class) {
echo("<ul>".$class.":<br>\n");
$vars = get_class_vars($class);
$methods = get_class_methods($class);
foreach($vars as $varname=>$value) {
echo("<li>var \$$varname = $value</li>\n");
}
foreach($methods as $method) {
echo("<li>method $method</li>\n");
}
echo "</ul>";
}
?>
|
Since php (4.0.6) does not have a function to get the parent class without actually creating an instance of the class, it does not trace the hierarchy.
Tags: datastructures