X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=reflection2php.php;h=c55eb65290bb0c2a19656ca967ff9abf8ba7d31b;hp=7768eeb9a65a027979a497bf152408beae469f2d;hb=19a017f746fe281d828d1783ef2a5991ce6114e4;hpb=29a54250b58e444974ae19840194e214cab80bd5 diff --git a/reflection2php.php b/reflection2php.php index 7768eeb..c55eb65 100755 --- a/reflection2php.php +++ b/reflection2php.php @@ -9,7 +9,7 @@ function m($m) { return $n; } function t($p) { - if ($c = $p->getClass()) return $c->getName() . " "; + if ($c = $p->getClass()) return "\\" . $c->getName() . " "; if ($p->isArray()) return "array "; } function c($n, $c) { @@ -59,12 +59,15 @@ printf("\n"); foreach ($ext->getClasses() as $class) { - printf("%s%s %s ", m($class->getModifiers()), $class->isInterface() ? "interface":"class" ,$class->getName()); + if ($class->inNamespace()) { + printf("namespace %s {\n", $class->getNamespaceName()); + } + printf("%s%s %s ", m($class->getModifiers()), $class->isInterface() ? "interface":"class" ,$class->getShortName()); if ($p = $class->getParentClass()) { - printf("extends %s ", $p->getName()); + printf("extends \\%s ", $p->getName()); } if ($i = $class->getInterfaceNames()) { - printf("implements %s ", implode(", ", array_filter($i,function($v){return$v!="Traversable";}))); + printf("implements \\%s ", implode(", \\", array_filter($i,function($v){return$v!="Traversable";}))); } printf("\n{\n"); @@ -102,6 +105,10 @@ foreach ($ext->getClasses() as $class) { } } - printf("}\n\n"); + printf("}\n"); + if ($class->inNamespace()) { + printf("}\n"); + } + printf("\n"); }