Automattic\WooCommerce\Caches

OrderCache::validate()protectedWC 1.0

Validate an object before caching it.

Method of the class: OrderCache{}

No Hooks.

Return

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() code WC 9.7.1

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;
}