Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders
PaymentGateway::get_supports_list
Get the provider supports list of the payment gateway.
Method of the class: PaymentGateway{}
No Hooks.
Returns
String[]. The provider supports list of the payment gateway.
Usage
$PaymentGateway = new PaymentGateway(); $PaymentGateway->get_supports_list( $payment_gateway ): array;
- $payment_gateway(WC_Payment_Gateway) (required)
- The payment gateway object.
PaymentGateway::get_supports_list() PaymentGateway::get supports list code WC 10.5.0
public function get_supports_list( WC_Payment_Gateway $payment_gateway ): array {
$supports_list = $payment_gateway->supports ?? array();
if ( ! is_array( $supports_list ) ) {
return array();
}
// Sanitize the list to ensure it only contains a list of key-like strings.
$sanitized_list = array();
foreach ( $supports_list as $support ) {
if ( ! is_string( $support ) ) {
continue;
}
$sanitized_list[] = sanitize_key( $support );
}
// Ensure the list contains unique values and re-indexed.
return array_values( array_unique( $sanitized_list ) );
}