WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

Automattic\WooCommerce\Proxies

LegacyProxy::get_instance_of() public WC 1.0

Gets an instance of a given legacy class. This must not be used to get instances of classes in the src directory.

If a given class needs a special procedure to get an instance of it, please add a private get_instance_of_(lowercased_class_name) and it will be automatically invoked. See also how objects of classes having a static instance method are retrieved, similar approaches can be used as needed to make use of existing factory methods such as e.g. 'load'.

Это метод класса: LegacyProxy{}

Хуков нет.

Возвращает

Объект. The instance of the class.

Использование

$LegacyProxy = new LegacyProxy();
$LegacyProxy->get_instance_of( $class_name, ...$args );
$class_name(строка) (обязательный)
The name of the class to get an instance for.
...$args(смешанный) (обязательный)
Parameters to be passed to the class constructor or to the appropriate internal 'get_instance_of_' method.

Код LegacyProxy::get_instance_of() WC 4.5.2

woocommerce/src/Proxies/LegacyProxy.php
<?php
public function get_instance_of( string $class_name, ...$args ) {
	if ( false !== strpos( $class_name, '\\' ) ) {
		throw new \Exception(
			'The LegacyProxy class is not intended for getting instances of classes in the src directory, please use ' .
			Definition::INJECTION_METHOD . ' method injection or the instance of ' . ContainerInterface::class . ' for that.'
		);
	}

	// If a class has a dedicated method to obtain a instance, use it.
	$method = 'get_instance_of_' . strtolower( $class_name );
	if ( method_exists( __CLASS__, $method ) ) {
		return $this->$method( ...$args );
	}

	// If the class is a singleton, use the "instance" method.
	if ( method_exists( $class_name, 'instance' ) ) {
		return $class_name::instance( ...$args );
	}

	// Fallback to simply creating a new instance of the class.
	return new $class_name( ...$args );
}