Automattic\WooCommerce\Admin\RemoteSpecs
DataSourcePoller::validate_spec
Validate the spec.
Method of the class: DataSourcePoller{}
No Hooks.
Returns
true|false. The result of the validation.
Usage
// protected - for code of main (parent) or child class $result = $this->validate_spec( $spec, $url );
- $spec(object) (required)
- The spec to validate.
- $url(string) (required)
- The url of the feed that provided the spec.
DataSourcePoller::validate_spec() DataSourcePoller::validate spec code WC 10.5.0
protected function validate_spec( $spec, $url ) {
$logger = self::get_logger();
$logger_context = array( 'source' => $url );
if ( ! $this->get_spec_key( $spec ) ) {
$logger->error(
'Spec is invalid because the id is missing in feed',
$logger_context
);
// phpcs:ignore
$logger->error( print_r( $spec, true ), $logger_context );
return false;
}
return true;
}