public static function addSchema(SchemaId $schemaId, SchemaDescriptor $schema)
    {
        $curie = $schemaId->getCurie();
        $curieMajor = $schemaId->getCurieWithMajorRev();

        // by id
        self::$schemas[$schemaId->toString()] = $schema;

        // by curie
        if (isset(self::$schemasByCurie[$curie])) {
            /** @var SchemaDescriptor $tmpSchema */
            $tmpSchema = self::$schemasByCurie[$curie];

            if ($schemaId->getVersion()->compare($tmpSchema->getId()->getVersion()) === 1) {
                self::$schemasByCurie[$curie] = &self::$schemas[$schemaId->toString()];
            }
        } else {
            self::$schemasByCurie[$curie] = &self::$schemas[$schemaId->toString()];
        }

        // by curie major
        if (isset(self::$schemasByCurieMajor[$curieMajor])) {
            /** @var SchemaDescriptor $tmpSchema */
            $tmpSchema = self::$schemasByCurieMajor[$curieMajor];

            if ($schemaId->getVersion()->compare($tmpSchema->getId()->getVersion()) === 1) {
                self::$schemasByCurieMajor[$curieMajor] = &self::$schemas[$schemaId->toString()];
            }
        } else {
            self::$schemasByCurieMajor[$curieMajor] = &self::$schemas[$schemaId->toString()];
        }

        ksort(self::$schemas);
        ksort(self::$schemasByCurie);
        ksort(self::$schemasByCurieMajor);
    }
public static function addSchema(SchemaId $schemaId, SchemaDescriptor $schema)
    {
        $curie = $schemaId->getCurie();
        $curieMajor = $schemaId->getCurieWithMajorRev();

        // by id
        self::$schemas[$schemaId->toString()] = $schema;

        // by curie
        if (isset(self::$schemasByCurie[$curie])) {
            /** @var SchemaDescriptor $tmpSchema */
            $tmpSchema = self::$schemasByCurie[$curie];

            if ($schemaId->getVersion()->compare($tmpSchema->getId()->getVersion()) === 1) {
                self::$schemasByCurie[$curie] = &self::$schemas[$schemaId->toString()];
            }
        } else {
            self::$schemasByCurie[$curie] = &self::$schemas[$schemaId->toString()];
        }

        // by curie major
        if (isset(self::$schemasByCurieMajor[$curieMajor])) {
            /** @var SchemaDescriptor $tmpSchema */
            $tmpSchema = self::$schemasByCurieMajor[$curieMajor];

            if ($schemaId->getVersion()->compare($tmpSchema->getId()->getVersion()) === 1) {
                self::$schemasByCurieMajor[$curieMajor] = &self::$schemas[$schemaId->toString()];
            }
        } else {
            self::$schemasByCurieMajor[$curieMajor] = &self::$schemas[$schemaId->toString()];
        }

        ksort(self::$schemas);
        ksort(self::$schemasByCurie);
        ksort(self::$schemasByCurieMajor);
    }
public static function addSchema ( SchemaId $ schemaId , SchemaDescriptor $ schema ) { $ curie = $ schemaId -> getCurie ( ) ; $ curieMajor = $ schemaId -> getCurieWithMajorRev ( ) ; // by id self :: $ schemas [ $ schemaId -> toString ( ) ] = $ schema ; // by curie if ( isset ( self :: $ schemasByCurie [ $ curie ] ) ) { /** @var SchemaDescriptor $tmpSchema */ $ tmpSchema = self :: $ schemasByCurie [ $ curie ] ; if ( $ schemaId -> getVersion ( ) -> compare ( $ tmpSchema -> getId ( ) -> getVersion ( ) ) === 1 ) { self :: $ schemasByCurie [ $ curie ] = & self :: $ schemas [ $ schemaId -> toString ( ) ] ; } } else { self :: $ schemasByCurie [ $ curie ] = & self :: $ schemas [ $ schemaId -> toString ( ) ] ; } // by curie major if ( isset ( self :: $ schemasByCurieMajor [ $ curieMajor ] ) ) { /** @var SchemaDescriptor $tmpSchema */ $ tmpSchema = self :: $ schemasByCurieMajor [ $ curieMajor ] ; if ( $ schemaId -> getVersion ( ) -> compare ( $ tmpSchema -> getId ( ) -> getVersion ( ) ) === 1 ) { self :: $ schemasByCurieMajor [ $ curieMajor ] = & self :: $ schemas [ $ schemaId -> toString ( ) ] ; } } else { self :: $ schemasByCurieMajor [ $ curieMajor ] = & self :: $ schemas [ $ schemaId -> toString ( ) ] ; } ksort ( self :: $ schemas ) ; ksort ( self :: $ schemasByCurie ) ; ksort ( self :: $ schemasByCurieMajor ) ; }
Adds a schema. An exception will be thrown when attempting to load
the same id multi times.

@param SchemaId         $schemaId
@param SchemaDescriptor $schema

@throws \RuntimeException on duplicate id
Adds a schema . An exception will be thrown when attempting to load the same id multi times .