mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
The WP containers don't seem to be used anywhere. There were imports, but they are not actually used it seems.
38 lines
1 KiB
PHP
38 lines
1 KiB
PHP
<?php
|
|
/**
|
|
* The services of the session module.
|
|
*
|
|
* @package WooCommerce\PayPalCommerce\Session
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace WooCommerce\PayPalCommerce\Session;
|
|
|
|
use WooCommerce\PayPalCommerce\Session\Cancellation\CancelController;
|
|
use WooCommerce\PayPalCommerce\Session\Cancellation\CancelView;
|
|
|
|
return array(
|
|
'session.handler' => function ( $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;
|
|
},
|
|
'session.cancellation.view' => function ( $container ) : CancelView {
|
|
return new CancelView();
|
|
},
|
|
'session.cancellation.controller' => function ( $container ) : CancelController {
|
|
return new CancelController(
|
|
$container->get( 'session.handler' ),
|
|
$container->get( 'session.cancellation.view' )
|
|
);
|
|
},
|
|
);
|