Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableDataStoreMeta::is_valid_cached_meta
Determine whether a cached meta entry is a well-formed array of meta rows.
An empty array is valid: it represents an order with no meta. Each non-empty element must be an object carrying the meta_id, meta_key and meta_value properties that database-backed rows always have (see CustomMetaDataStore::get_meta_data_for_object_ids()) and that downstream consumers read.
Метод класса: OrdersTableDataStoreMeta{}
Хуков нет.
Возвращает
bool. True when the value is a usable array of meta rows.
Использование
// private - только в коде основоного (родительского) класса $result = $this->is_valid_cached_meta( $object_meta ): bool;
- $object_meta(разное) (обязательный)
- The cached value to validate.
Код OrdersTableDataStoreMeta::is_valid_cached_meta() OrdersTableDataStoreMeta::is valid cached meta WC 11.1.1
private function is_valid_cached_meta( $object_meta ): bool {
if ( ! is_array( $object_meta ) ) {
return false;
}
foreach ( $object_meta as $meta_row ) {
if ( ! is_object( $meta_row )
|| ! property_exists( $meta_row, 'meta_id' )
|| ! property_exists( $meta_row, 'meta_key' )
|| ! property_exists( $meta_row, 'meta_value' ) ) {
return false;
}
}
return true;
}