Automattic\WooCommerce\Admin\API\Reports
DataStore::cast_numbers()
Casts strings returned from the database to appropriate data types for output.
Метод класса: DataStore{}
Хуки из метода
Возвращает
Массив|WP_Error
.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->cast_numbers( $array );
- $array(массив) (обязательный)
- Associative array of values extracted from the database.
Код DataStore::cast_numbers() DataStore::cast numbers WC 8.7.0
protected function cast_numbers( $array ) { $retyped_array = array(); $column_types = apply_filters( 'woocommerce_rest_reports_column_types', $this->column_types, $array ); foreach ( $array as $column_name => $value ) { if ( is_array( $value ) ) { $value = $this->cast_numbers( $value ); } if ( isset( $column_types[ $column_name ] ) ) { $retyped_array[ $column_name ] = $column_types[ $column_name ]( $value ); } else { $retyped_array[ $column_name ] = $value; } } return $retyped_array; }