WC_Tax::prepare_tax_rate()private staticWC 1.0

Prepare and format tax rate for DB insertion.

Method of the class: WC_Tax{}

No Hooks.

Return

Array.

Usage

$result = WC_Tax::prepare_tax_rate( $tax_rate );
$tax_rate(array) (required)
Tax rate to format.

WC_Tax::prepare_tax_rate() code WC 9.4.2

private static function prepare_tax_rate( $tax_rate ) {
	foreach ( $tax_rate as $key => $value ) {
		if ( method_exists( __CLASS__, 'format_' . $key ) ) {
			if ( 'tax_rate_state' === $key ) {
				$tax_rate[ $key ] = call_user_func( array( __CLASS__, 'format_' . $key ), sanitize_key( $value ) );
			} else {
				$tax_rate[ $key ] = call_user_func( array( __CLASS__, 'format_' . $key ), $value );
			}
		}
	}
	return $tax_rate;
}