Automattic\WooCommerce\Internal\Orders
PaymentInfo::get_card_icon
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() PaymentInfo::get card icon code WC 10.8.1
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" ) );
}