mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Fix phpcs errors
This commit is contained in:
parent
f5a2fca5fb
commit
a71c8b134a
9 changed files with 207 additions and 206 deletions
|
@ -72,25 +72,27 @@ class PaymentTokenRepository {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
/**
|
||||
* Return all tokens for a user.
|
||||
*
|
||||
* @param int $id The user id.
|
||||
* @return PaymentToken[]
|
||||
*/
|
||||
public function all_for_user_id( int $id ) {
|
||||
$tokens = get_user_meta( $id, self::USER_META, true );
|
||||
if($tokens) {
|
||||
return (array) $tokens;
|
||||
}
|
||||
$tokens = get_user_meta( $id, self::USER_META, true );
|
||||
if ( $tokens ) {
|
||||
return (array) $tokens;
|
||||
}
|
||||
|
||||
$tokens_array = [];
|
||||
try {
|
||||
$tokens = $this->endpoint->for_user( $id );
|
||||
update_user_meta( $id, self::USER_META, $tokens );
|
||||
return $tokens;
|
||||
} catch (RuntimeException $exception) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
$tokens_array = array();
|
||||
try {
|
||||
$tokens = $this->endpoint->for_user( $id );
|
||||
update_user_meta( $id, self::USER_META, $tokens );
|
||||
return $tokens;
|
||||
} catch ( RuntimeException $exception ) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a token for a user.
|
||||
|
|
|
@ -58,24 +58,6 @@ class SubscriptionModule implements ModuleInterface {
|
|||
10,
|
||||
2
|
||||
);
|
||||
|
||||
/*
|
||||
add_action('woocommerce_init', function () use($container) {
|
||||
$api = $container->get('api.endpoint.payment-token' );
|
||||
try {
|
||||
$tokens = $api->for_user(1);
|
||||
|
||||
for($i = 0; $i < count($tokens); $i++) {
|
||||
$api->delete_token($tokens[$i]);
|
||||
}
|
||||
|
||||
$a = 1;
|
||||
} catch (RuntimeException $exception) {
|
||||
$a = 1;
|
||||
}
|
||||
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue