1313use bdk \Debug ;
1414use bdk \Debug \AbstractComponent ;
1515use bdk \Debug \Abstraction \Abstracter ;
16- use bdk \Debug \Abstraction \Abstraction ;
1716use bdk \Debug \Abstraction \Object \Abstraction as ObjectAbstraction ;
1817use bdk \Debug \Abstraction \Object \Constants ;
1918use bdk \Debug \Abstraction \Object \Definition ;
2221use bdk \Debug \Abstraction \Object \Properties ;
2322use bdk \Debug \Abstraction \Object \PropertiesInstance ;
2423use bdk \Debug \Abstraction \Object \Subscriber ;
25- use bdk \Debug \Abstraction \Type ;
2624use bdk \Table \Element ;
27- use bdk \Table \Table ;
2825use ReflectionClass ;
2926use ReflectionEnumUnitCase ;
3027use RuntimeException ;
@@ -208,10 +205,11 @@ public function __construct(Abstracter $abstracter)
208205 $ this ->propertiesInstance = new PropertiesInstance ($ this );
209206 $ this ->definition = new Definition ($ this );
210207
211- if ($ abstracter ->debug ->parentInstance === null ) {
212- // we only need to subscribe to these events from root channel
213- $ abstracter ->debug ->eventManager ->addSubscriberInterface (new Subscriber ($ this ));
214- }
208+ // if we are the root instance, subscribe to events
209+ // otherwise ensure root instance is instantiated
210+ $ abstracter ->debug ->parentInstance === null
211+ ? $ abstracter ->debug ->eventManager ->addSubscriberInterface (new Subscriber ($ this ))
212+ : $ abstracter ->debug ->rootInstance ->abstracter ;
215213
216214 self ::$ values ['sectionOrder ' ] = $ abstracter ->getCfg ('objectSectionOrder ' );
217215 self ::$ values ['sort ' ] = $ abstracter ->getCfg ('objectSort ' );
@@ -233,16 +231,6 @@ public function getAbstraction($obj, $method = null, array $hist = array())
233231 if ($ reflector instanceof ReflectionEnumUnitCase) {
234232 $ reflector = $ reflector ->getEnum ();
235233 }
236- if ($ obj instanceof Element) {
237- $ hist [] = $ obj ;
238- $ this ->debug ->eventManager ->subscribe (Debug::EVENT_OBJ_ABSTRACT_END , [$ this , 'tableCellValueAbstracter ' ]);
239- $ values = $ obj ->jsonSerialize ();
240- $ values = $ this ->abstracter ->crate ($ values , $ method , $ hist );
241- $ this ->debug ->eventManager ->unsubscribe (Debug::EVENT_OBJ_ABSTRACT_END , [$ this , 'tableCellValueAbstracter ' ]);
242- return $ obj instanceof Table
243- ? new Abstraction (Type::TYPE_TABLE , $ values )
244- : $ values ;
245- }
246234 $ values = $ this ->getAbstractionValues ($ reflector , $ obj , $ method , $ hist );
247235 $ definitionValueStore = $ this ->definition ->getAbstraction ($ obj , $ values );
248236 $ abs = new ObjectAbstraction ($ definitionValueStore , $ values );
@@ -272,22 +260,6 @@ public static function buildValues(array $values = array())
272260 return \array_merge (self ::$ values , $ values );
273261 }
274262
275- /**
276- * If cell value is an object, set unstructuredValue for abstraction
277- *
278- * @param ObjectAbstraction $abs Object Abstraction instance
279- *
280- * @return void
281- */
282- public function tableCellValueAbstracter ($ abs )
283- {
284- if (isset ($ abs ['stringified ' ])) {
285- $ abs ['unstructuredValue ' ] = $ abs ['stringified ' ];
286- } elseif (isset ($ abs ['methods ' ]['__toString ' ]['returnValue ' ])) {
287- $ abs ['unstructuredValue ' ] = $ abs ['methods ' ]['__toString ' ]['returnValue ' ];
288- }
289- }
290-
291263 /**
292264 * Collect instance info
293265 * Property values & static method variables
@@ -301,7 +273,6 @@ private function doAbstraction(ObjectAbstraction $abs)
301273 if ($ abs ['isMaxDepth ' ] || $ abs ['isRecursion ' ]) {
302274 return ;
303275 }
304- $ abs ['isTraverseOnly ' ] = $ this ->helper ->isTraverseOnly ($ abs );
305276 /*
306277 Debug::EVENT_OBJ_ABSTRACT_START subscriber may
307278 set isExcluded
@@ -355,7 +326,6 @@ protected function getAbstractionValues(ReflectionClass $reflector, $obj, $metho
355326 'collectPropertyValues ' => true ,
356327 'fullyQualifyPhpDocType ' => $ this ->cfg ['fullyQualifyPhpDocType ' ],
357328 'hist ' => $ hist ,
358- 'isTraverseOnly ' => false ,
359329 'propertyOverrideValues ' => array (),
360330 'reflector ' => $ reflector ,
361331 )
0 commit comments