WooCommerce::call_static() public WC 4.4
Call a static method in a class. This should be used to execute any non-idempotent method in classes from the includes directory.
This method can be useful for unit tests, since methods called using this method can be easily mocked by using WC_Unit_Test_Case::register_legacy_proxy_static_mocks.
{} Это метод класса: WooCommerce{}
Хуков нет.
Возвращает
Разное. The result from the method.
Использование
$result = WooCommerce::call_static( $class_name, $method_name, ...$parameters );
- $class_name(строка) (обязательный)
- The name of the class containing the method.
- $method_name(строка) (обязательный)
- The name of the method.
- ...$parameters(разное) (обязательный)
- The parameters to pass to the method.
Список изменений
С версии 4.4 | Введена. |
Код WooCommerce::call_static() WooCommerce::call static WC 5.0.0
public function call_static( $class_name, $method_name, ...$parameters ) {
return wc_get_container()->get( LegacyProxy::class )->call_static( $class_name, $method_name, ...$parameters );
}