src/State/Traits/DataObjectSerializableTrait.php
public function unserialize($data)
    {
        $injector = \Injector::inst();

        $extraData = null;

        if (empty(self::$objectConstructorReflectionMethods[__CLASS__])) {
            self::$objectConstructorReflectionMethods[__CLASS__] = new \ReflectionMethod(__CLASS__, '__construct');
        }

        if (empty(self::$classConfigs[__CLASS__])) {
            self::$classConfigs[__CLASS__] = $injector->getConfigLocator()->locateConfigFor(__CLASS__);
        }

        if ($this instanceof ExtraDataInterface) {
            $unserialized = \Heystack\Core\unserialize($data);

            self::$objectConstructorReflectionMethods[__CLASS__]->invoke(
                $this,
                $unserialized[0]
            );

            $extraData = $unserialized[1];
        } else {
            self::$objectConstructorReflectionMethods[__CLASS__]->invoke(
                $this,
                \Heystack\Core\unserialize($data)
            );
        }

        // Ensure that the spec is loaded for the class
        if (self::$classConfigs[__CLASS__]) {
            $injector->load([__CLASS__ => self::$classConfigs[__CLASS__]]);
        }
        
        $injector->inject($this, __CLASS__);
        
        if ($extraData) {
            $this->setExtraData($extraData);
        }
    }
public function unserialize($data)
    {
        $injector = \Injector::inst();

        $extraData = null;

        if (empty(self::$objectConstructorReflectionMethods[__CLASS__])) {
            self::$objectConstructorReflectionMethods[__CLASS__] = new \ReflectionMethod(__CLASS__, '__construct');
        }

        if (empty(self::$classConfigs[__CLASS__])) {
            self::$classConfigs[__CLASS__] = $injector->getConfigLocator()->locateConfigFor(__CLASS__);
        }

        if ($this instanceof ExtraDataInterface) {
            $unserialized = \Heystack\Core\unserialize($data);

            self::$objectConstructorReflectionMethods[__CLASS__]->invoke(
                $this,
                $unserialized[0]
            );

            $extraData = $unserialized[1];
        } else {
            self::$objectConstructorReflectionMethods[__CLASS__]->invoke(
                $this,
                \Heystack\Core\unserialize($data)
            );
        }

        // Ensure that the spec is loaded for the class
        if (self::$classConfigs[__CLASS__]) {
            $injector->load([__CLASS__ => self::$classConfigs[__CLASS__]]);
        }
        
        $injector->inject($this, __CLASS__);
        
        if ($extraData) {
            $this->setExtraData($extraData);
        }
    }
public function unserialize ( $ data ) { $ injector = \ Injector :: inst ( ) ; $ extraData = null ; if ( empty ( self :: $ objectConstructorReflectionMethods [ __CLASS__ ] ) ) { self :: $ objectConstructorReflectionMethods [ __CLASS__ ] = new \ ReflectionMethod ( __CLASS__ , '__construct' ) ; } if ( empty ( self :: $ classConfigs [ __CLASS__ ] ) ) { self :: $ classConfigs [ __CLASS__ ] = $ injector -> getConfigLocator ( ) -> locateConfigFor ( __CLASS__ ) ; } if ( $ this instanceof ExtraDataInterface ) { $ unserialized = \ Heystack \ Core \ unserialize ( $ data ) ; self :: $ objectConstructorReflectionMethods [ __CLASS__ ] -> invoke ( $ this , $ unserialized [ 0 ] ) ; $ extraData = $ unserialized [ 1 ] ; } else { self :: $ objectConstructorReflectionMethods [ __CLASS__ ] -> invoke ( $ this , \ Heystack \ Core \ unserialize ( $ data ) ) ; } // Ensure that the spec is loaded for the class if ( self :: $ classConfigs [ __CLASS__ ] ) { $ injector -> load ( [ __CLASS__ => self :: $ classConfigs [ __CLASS__ ] ] ) ; } $ injector -> inject ( $ this , __CLASS__ ) ; if ( $ extraData ) { $ this -> setExtraData ( $ extraData ) ; } }
This routine simulates what would happen when a object is constructed
@param string $data
@return void
This routine simulates what would happen when a object is constructed