public override void AcceptObject(object obj) { if (obj is PhpResource res) { // resource(ID) of type (TYPE) _output.Append($"resource({res.Id}) of type ({res.TypeName})"); return; } if (obj is Delegate @delegate) { // delegate(TYPE) with method ({METHOD}) _output.Append($"delegate({obj.GetPhpTypeInfo().Name}) with method ({(@delegate.Method != null ? @delegate.Method.Name : PhpVariable.TypeNameNull)})"); return; } if (Enter(obj)) { var flds = TypeMembersUtils.EnumerateInstanceFieldsForDump(obj).ToList(); // Template: object(NAME)#ID (COUNT) { _output.Append($"object({obj.GetPhpTypeInfo().Name})#{unchecked((uint)obj.GetHashCode())} ({flds.Count}) {{"); _indent++; // object members foreach (var fld in flds) { // [key]=> // value NewLine(); OutputIndent(); _output.Append("[" + fld.Key + "]=>"); NewLine(); OutputIndent(); Accept(fld.Value); } // } _indent--; NewLine(); OutputIndent(); _output.Append("}"); // Leave(obj); } else { // *RECURSION* _output.Append(RECURSION); } }
public override void AcceptObject(object obj) { if (Enter(obj)) { var flds = TypeMembersUtils.EnumerateInstanceFieldsForDump(obj).ToList(); // Template: object(NAME)#ID (COUNT) { _output.Append($"object({obj.GetPhpTypeInfo().Name})#{unchecked((uint)obj.GetHashCode())} ({flds.Count}) {{"); _indent++; // object members foreach (var fld in flds) { // [key]=> // value NewLine(); OutputIndent(); _output.Append("[" + fld.Key + "]=>"); NewLine(); OutputIndent(); Accept(fld.Value); } // } _indent--; NewLine(); OutputIndent(); _output.Append("}"); // Leave(obj); } else { // *RECURSION* _output.Append(RECURSION); } }