Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableStatusUnionQuery::extract_order_direction │ private │ WC 1.0

Extracts the sort direction from the ORDER BY clause, or NULL when it isn't an ORDER BY on date_created_gmt alone (the only ordering the type_status_date index can satisfy within each branch).

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

Хуков нет.

Возвращает

string|null. 'ASC', 'DESC', or NULL when ineligible.

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

// private - только в коде основоного (родительского) класса
$result = $this->extract_order_direction( $orderby ): ?string;
$orderby(строка) (обязательный)
The ORDER BY clause, including the keyword.

Код OrdersTableStatusUnionQuery::extract_order_direction() WC 11.2.2

private function extract_order_direction( string $orderby ): ?string {
	foreach ( array( 'ASC', 'DESC' ) as $direction ) {
		if ( "ORDER BY {$this->orders_table}.date_created_gmt {$direction}" === $orderby ) {
			return $direction;
		}
	}

	return null;
}