6 foreach (Reflection
::getModifierNames($m) as $mn) {
12 if ($c = $p->getClass()) return $c->getName() . " ";
13 if ($p->isArray()) return "array ";
17 while ($c = $c->getParentClass()) {
18 if (array_key_exists($n, $c->getConstants())) {
23 foreach ((array) $c->getInterfaces() as $i) {
24 if (array_key_exists($n, $i->getConstants()) ||
!c($n, $i)) {
31 if (!strlen($ext = $argv[1]))
32 die(sprintf("Usage: %s <ext>\n", $argv[0]));
34 $ext = new ReflectionExtension($ext);
35 foreach ($ext->getClasses() as $class) {
37 printf("%s%s %s ", m($class->getModifiers()), $class->isInterface() ?
"interface":"class" ,$class->getName());
38 if ($p = $class->getParentClass()) {
39 printf("extends %s ", $p->getName());
41 if ($i = $class->getInterfaceNames()) {
42 printf("implements %s ", implode(", ", array_filter($i,function($v){return$v!="Traversable";})));
47 foreach ($class->getConstants() as $n => $v) {
48 c($n, $class) and $_+
=printf("\tconst %s = %s;\n", $n, var_export($v, true));
52 foreach ($class->getProperties() as $p) {
53 if ($p->getDeclaringClass()->getName() == $class->getName()) {
54 $_+
=printf("\t%s\$%s;\n", m($p->getModifiers()), $p->getName());
59 foreach ($class->getMethods() as $m) {
60 if ($m->getDeclaringClass()->getName() == $class->getName()) {
61 printf("\t%sfunction %s(", m($m->getModifiers()), $m->getName());
63 foreach ($m->getParameters() as $p) {
64 $p1 = sprintf("%s%s\$%s", t($p), $p->isPassedByReference()?
"&":"", $p->getName());
65 if ($p->isDefaultValueAvailable()) {
66 $p1 .= sprintf(" = %s", var_export($p->getDefaultValue(), true));
67 } elseif ($p->allowsNull() ||
$p->isOptional()) {
68 $p1 .= sprintf(" = NULL");
72 printf("%s) {\n\t}\n", implode(", ", $ps));