Automattic\WooCommerce\Internal\Caches
ProductCache::validate
Validate an object before caching it.
Метод класса: ProductCache{}
Хуков нет.
Возвращает
Строку[]|null. An array of error messages, or null if the object is valid.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->validate( $product ): ?array;
- $product(WC_Product) (обязательный)
- The product to validate.
Список изменений
| С версии 10.5.0 | Введена. |
Код ProductCache::validate() ProductCache::validate WC 10.5.2
protected function validate( $product ): ?array {
if ( ! $product instanceof WC_Product ) {
return array( 'The supplied product is not an instance of WC_Product' );
}
return null;
}