Allow filtering even when DB stored tokens are empty

This commit is contained in:
Mike Jolley 2016-05-16 15:32:54 +01:00
parent 83857de24d
commit e6b74ad629
1 changed files with 8 additions and 9 deletions

View File

@ -35,16 +35,15 @@ class WC_Payment_Tokens {
$customer_id
) );
if ( empty( $token_results ) ) {
return array();
}
$tokens = array();
foreach ( $token_results as $token_result ) {
if ( empty( $gateway_id ) || $gateway_id === $token_result->gateway_id ) {
$_token = self::get( $token_result->token_id, $token_result );
if ( ! empty( $_token ) ) {
$tokens[ $token_result->token_id ] = $_token;
if ( ! empty( $token_results ) ) {
foreach ( $token_results as $token_result ) {
if ( empty( $gateway_id ) || $gateway_id === $token_result->gateway_id ) {
$_token = self::get( $token_result->token_id, $token_result );
if ( ! empty( $_token ) ) {
$tokens[ $token_result->token_id ] = $_token;
}
}
}
}