use of php.runtime.memory.output.PlainPrinter in project jphp by jphp-compiler.
the class CallStackItem method toString.
public String toString(boolean withArgs) {
StringBuilder sb = new StringBuilder();
if (object instanceof Closure)
sb.append("{closure}");
else if (clazz != null) {
sb.append(clazz);
if (object == null)
sb.append("::");
else
sb.append("->");
sb.append(function);
} else if (function != null) {
sb.append(function);
} else
sb.append("<internal>");
sb.append("(");
if (withArgs) {
StringWriter writer = new StringWriter();
PlainPrinter printer = new PlainPrinter(null, writer);
int i = 0;
if (args != null)
for (Memory arg : args) {
printer.print(arg);
if (i != args.length - 1)
writer.append(", ");
i++;
}
sb.append(writer.toString());
}
sb.append(")");
if (trace != null && trace != TraceInfo.UNKNOWN) {
sb.append(" called at [");
sb.append(trace.getFileName());
sb.append(":");
sb.append(trace.getStartLine() + 1);
sb.append("]");
}
return sb.toString();
}
Aggregations