Automattic\WooCommerce\Internal\Orders

PaymentInfo::get_card_iconprivate staticWC 1.0

Generate a CSS-compatible SVG icon of a card brand.

Method of the class: PaymentInfo{}

No Hooks.

Returns

String.

Usage

$result = PaymentInfo::get_card_icon( ?string $brand ): string;
?string $brand(required)
.

PaymentInfo::get_card_icon() code WC 9.9.3

private static function get_card_icon( ?string $brand ): string {
	$brand = strtolower( (string) $brand );

	if ( ! in_array( $brand, self::KNOWN_CARD_BRANDS, true ) ) {
		$brand = 'unknown';
	}

	// phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode, WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
	return base64_encode( file_get_contents( __DIR__ . "/CardIcons/{$brand}.svg" ) );
}