Automattic\WooCommerce\Internal\DependencyManagement

AbstractServiceProvider::share()protectedWC 1.0

Register a shared entry in the container (get always returns the same instance).

Method of the class: AbstractServiceProvider{}

No Hooks.

Return

DefinitionInterface. The generated container definition.

Usage

// protected - for code of main (parent) or child class
$result = $this->share( $id, $concrete ) : DefinitionInterface;
$id(string) (required)
Entry id (typically a class or interface name).
$concrete(mixed|null)
Concrete entity to register under that id, null for automatic creation.
Default: null

AbstractServiceProvider::share() code WC 8.7.0

protected function share( string $id, $concrete = null ) : DefinitionInterface {
	return $this->add( $id, $concrete, true );
}