Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableMetaQuery::sanitize_cast_type
Returns the correct type for a given meta type.
Method of the class: OrdersTableMetaQuery{}
No Hooks.
Returns
String. MySQL type.
Usage
// private - for code of main (parent) class only $result = $this->sanitize_cast_type( $type ): string;
- $type(string)
- MySQL type.
Default:''
OrdersTableMetaQuery::sanitize_cast_type() OrdersTableMetaQuery::sanitize cast type code WC 11.0.1
private function sanitize_cast_type( string $type = '' ): string {
$meta_type = strtoupper( $type );
if ( ! $meta_type || ! preg_match( '/^(?:BINARY|CHAR|DATE|DATETIME|SIGNED|UNSIGNED|TIME|NUMERIC(?:\(\d+(?:,\s?\d+)?\))?|DECIMAL(?:\(\d+(?:,\s?\d+)?\))?)$/', $meta_type ) ) {
return 'CHAR';
}
if ( 'NUMERIC' === $meta_type ) {
$meta_type = 'SIGNED';
}
return $meta_type;
}