Automattic\WooCommerce\Api\Infrastructure

GraphQLControllerBase::resolve_classprivateWC 1.0

Resolve a class to an instance via the configured ClassResolver, or new.

Used internally to instantiate the PrincipalResolver per request. The autogenerated resolver classes use the detected ClassResolver directly (the FQCN is baked in at build time), so this helper is only the runtime path for infrastructure classes that the controller itself has to load.

Method of the class: GraphQLControllerBase{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->resolve_class( $class_name ): object;
$class_name(string) (required)
Fully-qualified name of the class to resolve.

GraphQLControllerBase::resolve_class() code WC 10.9.1

private function resolve_class( string $class_name ): object {
	$resolver = $this->get_class_resolver_fqcn();
	if ( null === $resolver ) {
		return new $class_name();
	}
	return $resolver::resolve_class( $class_name );
}