mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 12:25:15 +08:00
Refactor session handling
This commit is contained in:
parent
2df970a74a
commit
6aa75e62d4
2 changed files with 73 additions and 32 deletions
|
@ -15,17 +15,7 @@ use WooCommerce\PayPalCommerce\Session\Cancellation\CancelView;
|
|||
|
||||
return array(
|
||||
'session.handler' => function ( ContainerInterface $container ) : SessionHandler {
|
||||
|
||||
if ( is_null( WC()->session ) ) {
|
||||
return new SessionHandler();
|
||||
}
|
||||
$result = WC()->session->get( SessionHandler::ID );
|
||||
if ( is_a( $result, SessionHandler::class ) ) {
|
||||
return $result;
|
||||
}
|
||||
$session_handler = new SessionHandler();
|
||||
WC()->session->set( SessionHandler::ID, $session_handler );
|
||||
return $session_handler;
|
||||
return new SessionHandler();
|
||||
},
|
||||
'session.cancellation.view' => function ( ContainerInterface $container ) : CancelView {
|
||||
return new CancelView(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue