WordPress как на ладони
Очень Удобный и Быстрый Хостинг для сайтов на WordPress. Пользуюсь сам и вам рекомендую!
функция не описана


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 6.1.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 ) && ! $this->is_anonymous_class( $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 );