private function _processPropertyMapEntry(
        $propName,
        $propDefStr)
    {
        if (is_string($propName) && is_string($propDefStr)) {
            // This is a string key -> string value pair, so let's attempt to
            // compile it as a regular property definition and then add it to
            // our current class map if the entry is new/different.
            $this->_processPropertyDefinitionString( // Throws.
                $propName,
                $propDefStr
            );
        } else {
            // It cannot be a regular property definition. Check if this is an
            // "import class map" command. They can exist in the map and tell us
            // to import other classes, and their instructions are written as
            // [OtherClass::class, 'ownfield'=>'string'].
            $isImportCommand = false;
            if (is_int($propName) && is_string($propDefStr)) {
                // This is an int key -> string value pair, so we should treat
                // it as a potential "import class map" command. We must first
                // ensure that the class has a strictly global "\" prefix.
                $strictImportClassName = Utilities::createStrictClassPath($propDefStr);

                // Now check if the target class fits the "import class"
                // requirements.
                if (class_exists($strictImportClassName)
                    && is_subclass_of($strictImportClassName, '\\'.LazyJsonMapper::class)) {
                    // This is an "import other class" command! Thanks to the
                    // lack of an associative key, we saw a numeric array key
                    // (non-associative). And we've verified (above) that its
                    // value points to another valid class which is a sub-class
                    // of LazyJsonMapper (we don't bother allowing to import
                    // LazyJsonMapper itself, since it is the lowest possible
                    // base class and has 0 values).
                    $isImportCommand = true;

                    // Perform the import, which will compile the target (if
                    // necessary) and then merge its map with our current map.
                    // NOTE: There is no need for us to prevent the user from
                    // doing multiple imports of the same class, because the way
                    // the importing works ensures that we always re-use the
                    // same PropertyDefinition object instances from the other
                    // class every time we import the other class.
                    $this->_importClassMap( // Throws.
                        $strictImportClassName
                    );
                }
            }
            if (!$isImportCommand) {
                // This map-array value is definitely NOT okay.
                throw new BadPropertyMapException(sprintf(
                    'Invalid JSON property map entry "%s" in class "%s".',
                    $propName, $this->_currentClassInfo['strictClassName']
                ));
            }
        }
    }
private function _processPropertyMapEntry(
        $propName,
        $propDefStr)
    {
        if (is_string($propName) && is_string($propDefStr)) {
            // This is a string key -> string value pair, so let's attempt to
            // compile it as a regular property definition and then add it to
            // our current class map if the entry is new/different.
            $this->_processPropertyDefinitionString( // Throws.
                $propName,
                $propDefStr
            );
        } else {
            // It cannot be a regular property definition. Check if this is an
            // "import class map" command. They can exist in the map and tell us
            // to import other classes, and their instructions are written as
            // [OtherClass::class, 'ownfield'=>'string'].
            $isImportCommand = false;
            if (is_int($propName) && is_string($propDefStr)) {
                // This is an int key -> string value pair, so we should treat
                // it as a potential "import class map" command. We must first
                // ensure that the class has a strictly global "\" prefix.
                $strictImportClassName = Utilities::createStrictClassPath($propDefStr);

                // Now check if the target class fits the "import class"
                // requirements.
                if (class_exists($strictImportClassName)
                    && is_subclass_of($strictImportClassName, '\\'.LazyJsonMapper::class)) {
                    // This is an "import other class" command! Thanks to the
                    // lack of an associative key, we saw a numeric array key
                    // (non-associative). And we've verified (above) that its
                    // value points to another valid class which is a sub-class
                    // of LazyJsonMapper (we don't bother allowing to import
                    // LazyJsonMapper itself, since it is the lowest possible
                    // base class and has 0 values).
                    $isImportCommand = true;

                    // Perform the import, which will compile the target (if
                    // necessary) and then merge its map with our current map.
                    // NOTE: There is no need for us to prevent the user from
                    // doing multiple imports of the same class, because the way
                    // the importing works ensures that we always re-use the
                    // same PropertyDefinition object instances from the other
                    // class every time we import the other class.
                    $this->_importClassMap( // Throws.
                        $strictImportClassName
                    );
                }
            }
            if (!$isImportCommand) {
                // This map-array value is definitely NOT okay.
                throw new BadPropertyMapException(sprintf(
                    'Invalid JSON property map entry "%s" in class "%s".',
                    $propName, $this->_currentClassInfo['strictClassName']
                ));
            }
        }
    }
private function _processPropertyMapEntry ( $ propName , $ propDefStr ) { if ( is_string ( $ propName ) && is_string ( $ propDefStr ) ) { // This is a string key -> string value pair, so let's attempt to // compile it as a regular property definition and then add it to // our current class map if the entry is new/different. $ this -> _processPropertyDefinitionString ( // Throws. $ propName , $ propDefStr ) ; } else { // It cannot be a regular property definition. Check if this is an // "import class map" command. They can exist in the map and tell us // to import other classes, and their instructions are written as // [OtherClass::class, 'ownfield'=>'string']. $ isImportCommand = false ; if ( is_int ( $ propName ) && is_string ( $ propDefStr ) ) { // This is an int key -> string value pair, so we should treat // it as a potential "import class map" command. We must first // ensure that the class has a strictly global "\" prefix. $ strictImportClassName = Utilities :: createStrictClassPath ( $ propDefStr ) ; // Now check if the target class fits the "import class" // requirements. if ( class_exists ( $ strictImportClassName ) && is_subclass_of ( $ strictImportClassName , '\\' . LazyJsonMapper :: class ) ) { // This is an "import other class" command! Thanks to the // lack of an associative key, we saw a numeric array key // (non-associative). And we've verified (above) that its // value points to another valid class which is a sub-class // of LazyJsonMapper (we don't bother allowing to import // LazyJsonMapper itself, since it is the lowest possible // base class and has 0 values). $ isImportCommand = true ; // Perform the import, which will compile the target (if // necessary) and then merge its map with our current map. // NOTE: There is no need for us to prevent the user from // doing multiple imports of the same class, because the way // the importing works ensures that we always re-use the // same PropertyDefinition object instances from the other // class every time we import the other class. $ this -> _importClassMap ( // Throws. $ strictImportClassName ) ; } } if ( ! $ isImportCommand ) { // This map-array value is definitely NOT okay. throw new BadPropertyMapException ( sprintf ( 'Invalid JSON property map entry "%s" in class "%s".' , $ propName , $ this -> _currentClassInfo [ 'strictClassName' ] ) ) ; } } }
Process a property map entry for the current class.

Validates and compiles a map entry, and merges it with the current class
property map if everything went okay and the entry was new/different.

@param string|int $propName   The property name, or a numeric array key.
@param mixed      $propDefStr Should be a string describing the property
or the class to import, but may be
something else if the user has written an
invalid class property map.

@throws BadPropertyDefinitionException
@throws BadPropertyMapException
@throws CircularPropertyMapException
Process a property map entry for the current class .