default = new BaseResolver(); $this->registerDefaults(); do_action(BASE . 'schema_resolvers_loaded', $this); } public static function getInstance(): self { if (self::$instance === null) { self::$instance = new self(); } return self::$instance; } public function register(string $schemaType, SchemaResolverInterface $resolver): void { $this->resolvers[$schemaType] = $resolver; } public function get(string $schemaType): SchemaResolverInterface { // Check exact match, then parent chain if (isset($this->resolvers[$schemaType])) { return $this->resolvers[$schemaType]; } // Check parent type (TattooParlor → LocalBusiness → Organization) $builder = SchemaBuilder::getInstance(); $typeDef = $builder->getTypeDefinition($schemaType); if ($typeDef && !empty($typeDef['extends'])) { return $this->get($typeDef['extends']); } return $this->default; } private function registerDefaults(): void { // Register type-specific resolvers // Extensible via the action hook above } }