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


ExtendedContainer::replace() public WC 1.0

Replace an existing registration with a different concrete.

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

Хуков нет.


DefinitionInterface. The modified definition.


$ExtendedContainer = new ExtendedContainer();
$ExtendedContainer->replace( $class_name, $concrete ) : DefinitionInterface;
$class_name(строка) (обязательный)
The class name whose definition will be replaced.
$concrete(смешанный) (обязательный)
The new concrete (same as "add").

Код ExtendedContainer::replace() WC 4.9.1

public function replace( string $class_name, $concrete ) : DefinitionInterface {
	if ( ! $this->has( $class_name ) ) {
		throw new ContainerException( "The container doesn't have '$class_name' registered, please use 'add' instead of 'replace'." );

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

	return $this->extend( $class_name )->setConcrete( $concrete );