6 foreach (Reflection
::getModifierNames($m) as $mn) {
12 if ($c = $p->getClass()) return $c->getName() . " ";
13 if ($p->isArray()) return "array ";
16 if (!strlen($ext = $argv[1]))
17 die(sprintf("Usage: %s <ext>\n", $argv[0]));
19 $ext = new ReflectionExtension($ext);
20 foreach ($ext->getClasses() as $class) {
22 printf("%s%s %s ", m($class->getModifiers()), $class->isInterface() ?
"interface":"class" ,$class->getName());
23 if ($p = $class->getParentClass()) {
24 printf("extends %s ", $p->getName());
26 if ($i = $class->getInterfaceNames()) {
27 printf("implements %s ", implode(", ", array_filter($i,function($v){return$v!="Traversable";})));
32 foreach ($class->getConstants() as $n => $v) {
33 $_+
=printf("\tconst %s = %s;\n", $n, var_export($v, true));
37 foreach ($class->getProperties() as $p) {
38 if ($p->getDeclaringClass()->getName() == $class->getName()) {
39 $_+
=printf("\t%s\$%s;\n", m($p->getModifiers()), $p->getName());
44 foreach ($class->getMethods() as $m) {
45 if ($m->getDeclaringClass()->getName() == $class->getName()) {
46 printf("\t%sfunction %s(", m($m->getModifiers()), $m->getName());
48 foreach ($m->getParameters() as $p) {
49 $p1 = sprintf("%s%s", t($p), $p->isPassedByReference()?
"&":"");
50 if ($p->isOptional()) {
51 $p1 .= sprintf("[\$%s", $p->getName());
53 $p1 .= sprintf("\$%s", $p->getName());
55 if ($p->isDefaultValueAvailable()) {
56 $p1 .= sprintf(" = %s", var_export($p->getDefaultValue(), true));
57 } elseif ($p->allowsNull()) {
58 $p1 .= sprintf(" = NULL");
60 if ($p->isOptional()) {
65 printf("%s) {\n\t}\n", implode(", ", $ps));