1313use bdk \Debug \Abstraction \Abstracter ;
1414use bdk \Debug \Abstraction \Abstraction as BaseAbstraction ;
1515use bdk \Debug \Abstraction \AbstractObject ;
16- use bdk \Debug \Abstraction \Object \Constants ;
1716use bdk \Debug \Abstraction \Object \Definition ;
18- use bdk \Debug \Abstraction \Object \MethodParams ;
19- use bdk \Debug \Abstraction \Object \Methods ;
20- use bdk \Debug \Abstraction \Object \Properties ;
2117use bdk \Debug \Abstraction \Type ;
2218use bdk \Debug \Utility \ArrayUtil ;
2319use bdk \PubSub \ValueStore ;
@@ -84,7 +80,7 @@ public function __toString()
8480 */
8581 public function __unserialize (array $ data )
8682 {
87- $ data = $ this ->unserializeDataPrep ($ data );
83+ $ data[ ' inherited ' ] = $ this ->unserializeDataInherited ($ data );
8884 $ this ->inherited = $ data ['inherited ' ];
8985 unset($ data ['inherited ' ]);
9086 $ this ->values = $ data ;
@@ -136,8 +132,7 @@ public function jsonSerialize()
136132 public function getInheritedValues ()
137133 {
138134 $ values = $ this ->inherited ->getValues ();
139- unset($ values ['cfgFlags ' ]);
140- unset($ values ['__isUsed ' ]);
135+ unset($ values ['__isUsed ' ]); // don't inherit __isUsed
141136 return $ values ;
142137 }
143138
@@ -233,34 +228,6 @@ public function &offsetGet($key)
233228 return $ this ->values [$ key ];
234229 }
235230
236- /**
237- * Make sure property and method info contains expected keys
238- *
239- * @param \ArrayAccess $data Either instance data or inherited data
240- *
241- * @return array
242- */
243- public static function unserializeBuildValues ($ data )
244- {
245- $ data ['constants ' ] = \array_map (static function (array $ info ) {
246- return Constants::buildValues ($ info );
247- }, $ data ['constants ' ]);
248-
249- $ data ['properties ' ] = \array_map (static function (array $ info ) {
250- return Properties::buildValues ($ info );
251- }, $ data ['properties ' ]);
252-
253- $ data ['methods ' ] = \array_map (static function (array $ info ) {
254- $ info = Methods::buildValues ($ info );
255- $ info ['params ' ] = \array_map (static function (array $ paramInfo ) {
256- return MethodParams::buildValues ($ paramInfo );
257- }, $ info ['params ' ]);
258- return $ info ;
259- }, $ data ['methods ' ]);
260-
261- return $ data ;
262- }
263-
264231 /**
265232 * Get merged class & instance value
266233 *
@@ -273,7 +240,7 @@ private function getCombinedValue($key)
273240 $ value = isset ($ this ->values [$ key ])
274241 ? $ this ->values [$ key ]
275242 : null ;
276- if (\in_array ($ key , self ::$ keysTemp , true )) {
243+ if (\in_array ($ key , self ::$ keysTemp , true ) || $ key === ' __isUsed ' ) {
277244 return $ value ;
278245 }
279246 $ classVal = $ this ->inheritValue ($ key )
@@ -347,29 +314,6 @@ protected function sortData(array $array)
347314 return $ sortData ;
348315 }
349316
350- /**
351- * Ensure data contains all expected keys
352- *
353- * @param array $data Serialized data
354- *
355- * @return array
356- */
357- private function unserializeDataPrep (array $ data )
358- {
359- if (empty ($ data ['definition ' ])) {
360- // we are instance values
361- $ data = AbstractObject::buildValues ($ data );
362- }
363-
364- if (empty ($ data ['className ' ])) {
365- unset($ data ['className ' ]);
366- }
367-
368- $ data ['inherited ' ] = $ this ->unserializeDataInherited ($ data );
369-
370- return $ data ;
371- }
372-
373317 /**
374318 * Get inherited ValueStore
375319 *
@@ -382,16 +326,14 @@ private function unserializeDataInherited(array &$data)
382326 if (isset ($ data ['inherited ' ])) {
383327 $ inherited = $ data ['inherited ' ];
384328 unset($ data ['inherited ' ]);
385- return $ this -> unserializeBuildValues ( $ inherited) ;
329+ return $ inherited ;
386330 }
387331 if (isset ($ data ['classDefinition ' ])) {
388332 // maintain backwards compatibility - v3.1 used 'classDefinition'
389333 $ inherited = $ data ['classDefinition ' ];
390334 unset($ data ['classDefinition ' ]);
391- return $ this -> unserializeBuildValues ( $ inherited) ;
335+ return $ inherited ;
392336 }
393- // maintain backwards compatibility - v3.0 did not inherit
394- $ data = $ this ->unserializeBuildValues ($ data );
395337 return new ValueStore (AbstractObject::buildValues (Definition::buildValues ()));
396338 }
397339}
0 commit comments