woocommerce-paypal-payments/modules/ppcp-vaulting/src/PaymentTokenHelper.php
Emili Castells Guasch fb0725df77 Improve dockblock
2023-09-07 10:08:18 +02:00

35 lines
675 B
PHP

<?php
/**
* Payment Tokens helper methods.
*
* @package WooCommerce\PayPalCommerce\Vaulting
*/
declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\Vaulting;
use WC_Payment_Token;
/**
* Class PaymentTokenHelper
*/
class PaymentTokenHelper {
/**
* Checks if given token exist as WC Payment Token.
*
* @param WC_Payment_Token[] $wc_tokens WC Payment Tokens.
* @param string $token_id Payment Token ID.
* @return bool
*/
public function token_exist( array $wc_tokens, string $token_id ): bool {
foreach ( $wc_tokens as $wc_token ) {
if ( $wc_token->get_token() === $token_id ) {
return true;
}
}
return false;
}
}