final public function unserialize(
        $serialized = null)
    {
        $objectData = null;

        try {
            // Attempt to unpack the serialized data. Do not @suppress any
            // syntax errors, since the user needs to know if they've provided
            // a bad serialized string (or even a non-string value).
            // NOTE: If the original object only contained perfect JSON data,
            // then there are no sub-objects. But if any sub-objects existed
            // within the data, this will recursively unserialize those too.
            $objectData = unserialize($serialized); // Throws.
        } catch (\Exception $e) { // IMPORTANT: Catch ANY exception!
            // This can literally ONLY happen if the user had given us (and then
            // serialized) non-JSON data containing other objects that attempt
            // (and fail) unserialization now and throw an exception instead.
            throw new LazySerializationException(sprintf(
                'Unexpected exception encountered while unserializing a sub-object. Error: %s',
                $e->getMessage()
            ));
        }

        if (!is_array($objectData)) {
            // Anything other than an array means that $serialized was invalid.
            throw new LazySerializationException(
                'The serialized object data that you provided could not be unserialized.'
            );
        }

        // The data is fine. Now just construct this new object instance.
        // NOTE: Important since ctor builds/links its necessary property map.
        // NOTE: The unserialized object (or its data) has no links to the
        // originally serialized object anymore, apart from the fact that (just
        // like ANY two identical classes) they would both be linked to the
        // same compiled class property map ("_compiledPropertyMapLink").
        $this->__construct($objectData); // Throws.
    }
final public function unserialize(
        $serialized = null)
    {
        $objectData = null;

        try {
            // Attempt to unpack the serialized data. Do not @suppress any
            // syntax errors, since the user needs to know if they've provided
            // a bad serialized string (or even a non-string value).
            // NOTE: If the original object only contained perfect JSON data,
            // then there are no sub-objects. But if any sub-objects existed
            // within the data, this will recursively unserialize those too.
            $objectData = unserialize($serialized); // Throws.
        } catch (\Exception $e) { // IMPORTANT: Catch ANY exception!
            // This can literally ONLY happen if the user had given us (and then
            // serialized) non-JSON data containing other objects that attempt
            // (and fail) unserialization now and throw an exception instead.
            throw new LazySerializationException(sprintf(
                'Unexpected exception encountered while unserializing a sub-object. Error: %s',
                $e->getMessage()
            ));
        }

        if (!is_array($objectData)) {
            // Anything other than an array means that $serialized was invalid.
            throw new LazySerializationException(
                'The serialized object data that you provided could not be unserialized.'
            );
        }

        // The data is fine. Now just construct this new object instance.
        // NOTE: Important since ctor builds/links its necessary property map.
        // NOTE: The unserialized object (or its data) has no links to the
        // originally serialized object anymore, apart from the fact that (just
        // like ANY two identical classes) they would both be linked to the
        // same compiled class property map ("_compiledPropertyMapLink").
        $this->__construct($objectData); // Throws.
    }
final public function unserialize ( $ serialized = null ) { $ objectData = null ; try { // Attempt to unpack the serialized data. Do not @suppress any // syntax errors, since the user needs to know if they've provided // a bad serialized string (or even a non-string value). // NOTE: If the original object only contained perfect JSON data, // then there are no sub-objects. But if any sub-objects existed // within the data, this will recursively unserialize those too. $ objectData = unserialize ( $ serialized ) ; // Throws. } catch ( \ Exception $ e ) { // IMPORTANT: Catch ANY exception! // This can literally ONLY happen if the user had given us (and then // serialized) non-JSON data containing other objects that attempt // (and fail) unserialization now and throw an exception instead. throw new LazySerializationException ( sprintf ( 'Unexpected exception encountered while unserializing a sub-object. Error: %s' , $ e -> getMessage ( ) ) ) ; } if ( ! is_array ( $ objectData ) ) { // Anything other than an array means that $serialized was invalid. throw new LazySerializationException ( 'The serialized object data that you provided could not be unserialized.' ) ; } // The data is fine. Now just construct this new object instance. // NOTE: Important since ctor builds/links its necessary property map. // NOTE: The unserialized object (or its data) has no links to the // originally serialized object anymore, apart from the fact that (just // like ANY two identical classes) they would both be linked to the // same compiled class property map ("_compiledPropertyMapLink"). $ this -> __construct ( $ objectData ) ; // Throws. }
Called during unserialization of the object.

You are not supposed to call this directly. Instead, use PHP's global
`unserialize()` call:

```php
$restoredObj = unserialize($savedStr);
```

This unserializer is thin and efficient. It simply unpacks the serialized
raw data array and uses it as the new object's data, without validating
any of the actual values within the serialized data array. It's intended
to get the new object into the same JSON data state as the serialized
object, which is why we don't re-analyze the data after unserialization.

Note that the unserialization will call the constructor, with a single
argument (your unserialized JSON data array). Everything that the default
constructor performs will happen during unserialization, EXACTLY as if
you had created a brand new object and given it the data array directly.

You can therefore fully trust your unserialized objects as much as you
already trust your manually created ones! And you can even store them
somewhere and then unserialize them at any time in the future, during a
completely separate PHP process, and even years from now as long as your
project still contains the specific (sub)-class that you originally
serialized. Have fun!

@param string $serialized The string representation of the object.

@throws LazySerializationException If the raw, serialized data cannot be
unserialized at all.
@throws LazyJsonMapperException    If there are any problems creating the
class that you are unserializing. See
the regular constructor for error
reasons, but disregard all of its data
validation reasons, since unserialized
JSON data is not validated (analyzed)
when it reaches the constructor. The
most likely reasons why this exception
would be thrown during `unserialize()`
is that your class property map is
invalid and could not be compiled, and
thus the object couldn't be recreated,
OR that a custom `_init()` threw.

@see LazyJsonMapper::__construct()
Called during unserialization of the object .