Automattic\WooCommerce\Internal\DependencyManagement\ServiceProviders

AbstractInterfaceServiceProvider::add_with_implements_tags()protectedWC 1.0

Register a class in the container and add tags for all the interfaces it implements.

This also updates the $this->provides property with the interfaces provided by the class, and ensures that the property doesn't contain duplicates.

Метод класса: AbstractInterfaceServiceProvider{}

Хуков нет.

Возвращает

DefinitionInterface.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->add_with_implements_tags( $id, $concrete, ?bool $shared ): DefinitionInterface;
$id(строка) (обязательный)
Entry ID (typically a class or interface name).
$concrete(разное|null)
Concrete entity to register under that ID, null for automatic creation.
По умолчанию: null
?bool $shared **
-
По умолчанию: null

Код AbstractInterfaceServiceProvider::add_with_implements_tags() WC 9.6.1

protected function add_with_implements_tags( string $id, $concrete = null, ?bool $shared = null ): DefinitionInterface {
	$definition = $this->add( $id, $concrete, $shared );
	foreach ( class_implements( $id ) as $interface ) {
		$definition->addTag( $interface );
	}

	return $definition;
}