final public function assignObjectData(
        array $objectData = [],
        $requireAnalysis = false)
    {
        // Save the provided JSON data array.
        $this->_objectData = $objectData;

        // Recursively look for missing/bad JSON properties, if scan requested.
        // NOTE: "Bad" in this case includes things like fatal mismatches
        // between the definition of a property and the actual JSON data for it.
        // NOTE: This analysis includes ALL problems with the class and its
        // entire hierarchy (recursively), which means that it can produce
        // really long error messages. It will warn about ALL missing properties
        // that exist in the data but are not defined in the class, and it will
        // warn about ALL bad properties that existed in the data but cannot be
        // mapped in the way that the class map claims.
        if ($requireAnalysis) {
            $analysis = $this->exportClassAnalysis(); // Never throws.
            if ($analysis->hasProblems()) {
                // Since there were problems, throw with all combined summaries.
                throw new LazyJsonMapperException(
                    $analysis->generateNiceSummariesAsString()
                );
            }
        }

        // Call the custom initializer, where the subclass can do its own init.
        // NOTE: This is necessary for safely encapsulating the subclass' code.
        try {
            $this->_init();
        } catch (LazyUserException $e) {
            throw $e; // Re-throw user-error as is, since it's a proper exception.
        } catch (\Exception $e) { // IMPORTANT: Catch ANY other exception!
            // Ensure that they didn't throw something dumb from their code.
            // We'll even swallow the message, to truly discourage misuse.
            throw new LazyUserException(
                'Invalid exception thrown by _init(). Must use LazyUserException.'
            );
        }
    }
final public function assignObjectData(
        array $objectData = [],
        $requireAnalysis = false)
    {
        // Save the provided JSON data array.
        $this->_objectData = $objectData;

        // Recursively look for missing/bad JSON properties, if scan requested.
        // NOTE: "Bad" in this case includes things like fatal mismatches
        // between the definition of a property and the actual JSON data for it.
        // NOTE: This analysis includes ALL problems with the class and its
        // entire hierarchy (recursively), which means that it can produce
        // really long error messages. It will warn about ALL missing properties
        // that exist in the data but are not defined in the class, and it will
        // warn about ALL bad properties that existed in the data but cannot be
        // mapped in the way that the class map claims.
        if ($requireAnalysis) {
            $analysis = $this->exportClassAnalysis(); // Never throws.
            if ($analysis->hasProblems()) {
                // Since there were problems, throw with all combined summaries.
                throw new LazyJsonMapperException(
                    $analysis->generateNiceSummariesAsString()
                );
            }
        }

        // Call the custom initializer, where the subclass can do its own init.
        // NOTE: This is necessary for safely encapsulating the subclass' code.
        try {
            $this->_init();
        } catch (LazyUserException $e) {
            throw $e; // Re-throw user-error as is, since it's a proper exception.
        } catch (\Exception $e) { // IMPORTANT: Catch ANY other exception!
            // Ensure that they didn't throw something dumb from their code.
            // We'll even swallow the message, to truly discourage misuse.
            throw new LazyUserException(
                'Invalid exception thrown by _init(). Must use LazyUserException.'
            );
        }
    }
final public function assignObjectData ( array $ objectData = [ ] , $ requireAnalysis = false ) { // Save the provided JSON data array. $ this -> _objectData = $ objectData ; // Recursively look for missing/bad JSON properties, if scan requested. // NOTE: "Bad" in this case includes things like fatal mismatches // between the definition of a property and the actual JSON data for it. // NOTE: This analysis includes ALL problems with the class and its // entire hierarchy (recursively), which means that it can produce // really long error messages. It will warn about ALL missing properties // that exist in the data but are not defined in the class, and it will // warn about ALL bad properties that existed in the data but cannot be // mapped in the way that the class map claims. if ( $ requireAnalysis ) { $ analysis = $ this -> exportClassAnalysis ( ) ; // Never throws. if ( $ analysis -> hasProblems ( ) ) { // Since there were problems, throw with all combined summaries. throw new LazyJsonMapperException ( $ analysis -> generateNiceSummariesAsString ( ) ) ; } } // Call the custom initializer, where the subclass can do its own init. // NOTE: This is necessary for safely encapsulating the subclass' code. try { $ this -> _init ( ) ; } catch ( LazyUserException $ e ) { throw $ e ; // Re-throw user-error as is, since it's a proper exception. } catch ( \ Exception $ e ) { // IMPORTANT: Catch ANY other exception! // Ensure that they didn't throw something dumb from their code. // We'll even swallow the message, to truly discourage misuse. throw new LazyUserException ( 'Invalid exception thrown by _init(). Must use LazyUserException.' ) ; } }
Assign a new internal JSON data array for this object.

This is used by the constructor for assigning the initial internal data
state, but can also be very useful for users who want to manually replace
the contents of their object at a later time.

For example, it might suit your project design better to first construct
an empty object, and *then* pass it to some other function which actually
fills it with the JSON data. This function allows you to achieve that.

The entire internal data storage will be replaced with the new data.

@param array $objectData      Decoded JSON data as an array (NOT object).
@param bool  $requireAnalysis Whether to analyze the JSON data and throw
if there are problems with mapping. See
`__construct()` for more details.

@throws LazyJsonMapperException If JSON data analysis requested and any
of the map's property definitions are
bad/missing. Also if a custom class
`_init()` threw any kind of exception.

@see LazyJsonMapper::__construct()
@see LazyJsonMapper::_init()
Assign a new internal JSON data array for this object .