WooCommerce Code Reference

ClassResolver
in package

Class resolver for code-API command classes and other infrastructure classes.

Plugins that implement their own API and want their command and infrastructure classes instantiated through a container of their own can ship their own ClassResolver class at <plugin-api-namespace>\Infrastructure\ClassResolver with the same public signature: ApiBuilder detects it during generation and routes the generated resolvers through it. When no such class is present, resolvers fall back to new $class_name().

Table of Contents

resolve_class()  : object
Resolve a class to an instance.

Methods

resolve_class()

Resolve a class to an instance.

public static resolve_class(string $class_name) : object
Parameters
$class_name : string

Fully qualified name of the class to resolve.

Return values
objectAn instance of $class_name.