public override void AcceptObject(object obj) { if (obj is PhpResource res) { // Resource id #ID _output.Append($"Resource id #{res.Id}"); NewLine(); return; } if (obj is Delegate @delegate) { // Delegate ({METHOD}) _output.Append($"Delegate ({(@delegate.Method != null ? @delegate.Method.Name : PhpVariable.TypeNameNull)})"); return; } // typename Object _output.Append(obj.GetPhpTypeInfo().Name); _output.Append(" "); _output.Append("Object"); if (Enter(obj)) { // ( NewLine(); OutputIndent(); _output.Append("("); NewLine(); _indent++; // object members foreach (var fld in TypeMembersUtils.EnumerateInstanceFieldsForPrint(obj)) { OutputIndent(); _output.Append("[" + fld.Key + "] => "); _indent++; Accept(fld.Value); _indent--; NewLine(); } _indent--; OutputIndent(); _output.Append(")"); // Leave(obj); NewLine(); } else { _output.Append(RECURSION); } }
public override void AcceptObject(object obj) { // typename Object _output.Append(obj.GetPhpTypeInfo().Name); _output.Append(" "); _output.Append("Object"); if (Enter(obj)) { // ( NewLine(); OutputIndent(); _output.Append("("); NewLine(); _indent++; // object members foreach (var fld in TypeMembersUtils.EnumerateInstanceFieldsForPrint(obj)) { OutputIndent(); _output.Append("[" + fld.Key + "] => "); _indent++; Accept(fld.Value); _indent--; NewLine(); } _indent--; OutputIndent(); _output.Append(")"); // Leave(obj); NewLine(); } else { _output.Append(RECURSION); } }