Automattic\WooCommerce\Internal\Admin\Settings\PaymentProviders

PaymentGateway::get_supports_list()publicWC 1.0

Get the provider supports list of the payment gateway.

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

Хуков нет.

Возвращает

Строку[]. The provider supports list of the payment gateway.

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

$PaymentGateway = new PaymentGateway();
$PaymentGateway->get_supports_list( $payment_gateway ): array;
$payment_gateway(WC_Payment_Gateway) (обязательный)
The payment gateway object.

Код PaymentGateway::get_supports_list() WC 9.6.1

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