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


ExtendedContainer::add() public WC 1.0

Register a class in the container.

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

Хуков нет.


DefinitionInterface. The generated definition for the container.


$ExtendedContainer = new ExtendedContainer();
$ExtendedContainer->add( $class_name, $concrete, $shared ) : DefinitionInterface;
$class_name(строка) (обязательный)
Class name.
How to resolve the class with get: a factory callback, a concrete instance, another class name, or null to just create an instance of the class.
По умолчанию: null
Whether the resolution should be performed only once and cached.
По умолчанию: null

Код ExtendedContainer::add() WC 6.1.1

public function add( string $class_name, $concrete = null, bool $shared = null ) : DefinitionInterface {
	if ( ! $this->is_class_allowed( $class_name ) ) {
		throw new ContainerException( "You cannot add '$class_name', only classes in the {$this->woocommerce_namespace} namespace are allowed." );

	$concrete_class = $this->get_class_from_concrete( $concrete );
	if ( isset( $concrete_class ) && ! $this->is_class_allowed( $concrete_class ) ) {
		throw new ContainerException( "You cannot add concrete '$concrete_class', only classes in the {$this->woocommerce_namespace} namespace are allowed." );

	// We want to use a definition class that does not support constructor injection to avoid accidental usage.
	if ( ! $concrete instanceof DefinitionInterface ) {
		$concrete = new Definition( $class_name, $concrete );

	return parent::add( $class_name, $concrete, $shared );