Automattic\WooCommerce\Internal\DataStores\Orders

CustomOrdersTableController::get_data_store_instance()privateWC 1.0

Gets the instance of a given data store.

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

Хуков нет.

Возвращает

\WC_Object_Data_Store_Interface|Строку. The actual data store to use.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_data_store_instance( $default_data_store, $type );
$default_data_store(\WC_Object_Data_Store_Interface|строка) (обязательный)
The default data store (as received via the appropriate hooks).
$type(строка) (обязательный)
The type of the data store to get.

Код CustomOrdersTableController::get_data_store_instance() WC 8.7.0

private function get_data_store_instance( $default_data_store, string $type ) {
	if ( $this->custom_orders_table_usage_is_enabled() ) {
		switch ( $type ) {
			case 'order_refund':
				return $this->refund_data_store;
			default:
				return $this->data_store;
		}
	} else {
		return $default_data_store;
	}
}