WooCommerce::call_function()publicWC 4.4

Call a user function. This should be used to execute any non-idempotent function, especially those in the includes directory or provided by WordPress.

This method can be useful for unit tests, since functions called using this method can be easily mocked by using WC_Unit_Test_Case::register_legacy_proxy_function_mocks.

Метод класса: WooCommerce{}

Хуков нет.

Возвращает

Разное. The result from the function.

Использование

$WooCommerce = new WooCommerce();
$WooCommerce->call_function( $function_name, ...$parameters );
$function_name(строка) (обязательный)
The function to execute.
...$parameters(разное) (обязательный)
The parameters to pass to the function.

Список изменений

С версии 4.4 Введена.

Код WooCommerce::call_function() WC 8.7.0

public function call_function( $function_name, ...$parameters ) {
	return wc_get_container()->get( LegacyProxy::class )->call_function( $function_name, ...$parameters );
}