Automattic\WooCommerce\Internal\DependencyManagement\ServiceProviders
AbstractInterfaceServiceProvider::add_with_implements_tags()
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.
Method of the class: AbstractInterfaceServiceProvider{}
No Hooks.
Return
DefinitionInterface
.
Usage
// protected - for code of main (parent) or child class $result = $this->add_with_implements_tags( $id, $concrete, ?bool $shared ): 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 - ?bool $shared **
- -
Default: null
AbstractInterfaceServiceProvider::add_with_implements_tags() AbstractInterfaceServiceProvider::add with implements tags code WC 9.5.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; }