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.


DefinitionInterface. The generated container definition.


// 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 entity to register under that id, null for automatic creation.
Default: null

AbstractServiceProvider::share() code WC 8.9.0

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