Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableQuery::sanitize_order()privateWC 1.0

Makes sure the order in an ORDER BY statement is either 'ASC' o 'DESC'.

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

No Hooks.

Return

String. The sanitized order.

Usage

// private - for code of main (parent) class only
$result = $this->sanitize_order( $order ): string;
$order(string) (required)
The unsanitized order.

Код OrdersTableQuery::sanitize_order() WC 7.1.0

private function sanitize_order( string $order ): string {
	$order = strtoupper( $order );

	return in_array( $order, array( 'ASC', 'DESC' ), true ) ? $order : 'DESC';
}