Automattic\WooCommerce\Internal\Admin\Settings\PaymentProviders

PaymentGateway::validate_recommended_payment_methodprotectedWC 1.0

Validate a recommended payment method entry.

Method of the class: PaymentGateway{}

No Hooks.

Returns

true|false. True if the recommended payment method entry is valid, false otherwise.

Usage

// protected - for code of main (parent) or child class
$result = $this->validate_recommended_payment_method( $recommended_pm ): bool;
$recommended_pm(mixed) (required)
The recommended payment method entry to validate.

PaymentGateway::validate_recommended_payment_method() code WC 9.9.4

protected function validate_recommended_payment_method( $recommended_pm ): bool {
	// We require at least `id` and `title`.
	return is_array( $recommended_pm ) &&
			! empty( $recommended_pm['id'] ) &&
			! empty( $recommended_pm['title'] );
}