Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors

PublishBeforeTimeRuleProcessor::validate()publicWC 1.0

Validates the rule.

Метод класса: PublishBeforeTimeRuleProcessor{}

Хуков нет.

Возвращает

true|false. Pass/fail.

Использование

$PublishBeforeTimeRuleProcessor = new PublishBeforeTimeRuleProcessor();
$PublishBeforeTimeRuleProcessor->validate( $rule );
$rule(объект) (обязательный)
The rule to validate.

Код PublishBeforeTimeRuleProcessor::validate() WC 8.9.3

public function validate( $rule ) {
	if ( ! isset( $rule->publish_before ) ) {
		return false;
	}

	try {
		new \DateTime( $rule->publish_before );
	} catch ( \Throwable $e ) {
		return false;
	}

	return true;
}