+ $_=0;
+ foreach ($c->getConstants() as $n => $v) {
+ c($n, $c) and $_+=fprintf($out, "\t\tconst %s = %s;\n", $n,
+ var_export($v, true));
+ }
+ $_ and fprintf($out, "\n");
+ $_=0;
+ foreach ($c->getProperties() as $p) {
+ if ($p->getDeclaringClass()->getName() == $c->getName()) {
+ $_+=fprintf($out, "\t\t%s\$%s;\n", m($p->getModifiers()),
+ $p->getName());
+ }
+ }
+ $_ and fprintf($out, "\n");
+
+ foreach ($c->getMethods() as $m) {
+ if ($m->getDeclaringClass()->getName() == $c->getName()) {
+ fprintf($out, "\t\t%sfunction %s(", m($m->getModifiers()),
+ $m->getName());
+ $ps = array();
+ foreach ($m->getParameters() as $p) {
+ $p1 = sprintf("%s%s\$%s", t($p),
+ $p->isPassedByReference()?"&":"", $p->getName());
+ if ($p->isOptional()) {
+ if ($p->isDefaultValueAvailable()) {
+ $p1 .= sprintf(" = %s",
+ var_export($p->getDefaultValue(), true));
+ } elseif (!($p->isArray() || $p->getClass()) || $p->allowsNull()) {
+ $p1 .= sprintf(" = NULL");
+ } elseif ($p->isArray()) {
+ $p1 .= " = array()";
+ }
+ }
+ $ps[] = $p1;
+ }
+ fprintf($out, "%s)", implode(", ", $ps));
+ if ($m->isAbstract()) {
+ fprintf($out, ";\n\n");
+ } else {
+ fprintf($out, " {\n\t\t}\n\n");
+ }
+ }
+ }
+
+ fprintf($out, "\t}\n");
+
+ }