Automattic\WooCommerce\Caches
OrderCache::validate
Validate an object before caching it.
Method of the class: OrderCache{}
No Hooks.
Returns
String[]|null. An array of error messages, or null if the object is valid.
Usage
// protected - for code of main (parent) or child class $result = $this->validate( $object ): ?array;
- $object(array|object) (required)
- The object to validate.
OrderCache::validate() OrderCache::validate code WC 10.7.0
protected function validate( $object ): ?array {
if ( ! $object instanceof \WC_Abstract_Order ) {
return array( 'The supplied order is not an instance of WC_Abstract_Order, ' . gettype( $object ) );
}
return null;
}