wc_remove_number_precision_deep logic simplified

This commit is contained in:
Khan M Rashedun-Naby 2018-05-24 22:55:00 +06:00
parent 187eff6e95
commit 2725cd56d4
1 changed files with 7 additions and 6 deletions

View File

@ -1603,16 +1603,17 @@ function wc_add_number_precision_deep( $value, $round = true ) {
* *
* @since 3.2.0 * @since 3.2.0
* @param array $value Number to add precision to. * @param array $value Number to add precision to.
* @return int * @return int|array
*/ */
function wc_remove_number_precision_deep( $value ) { function wc_remove_number_precision_deep( $value ) {
if ( is_array( $value ) ) { if ( ! is_array( $value ) ) {
foreach ( $value as $key => $subvalue ) {
$value[ $key ] = wc_remove_number_precision_deep( $subvalue );
}
} else {
$value = wc_remove_number_precision( $value ); $value = wc_remove_number_precision( $value );
} }
foreach ( $value as $key => $sub_value ) {
$value[ $key ] = wc_remove_number_precision_deep( $sub_value );
}
return $value; return $value;
} }