-
Notifications
You must be signed in to change notification settings - Fork 47
/
bootstrap.php
43 lines (35 loc) · 1.11 KB
/
bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* Bootstraps the modular app.
*
* @package WooCommerce\PayPalCommerce
*/
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Package;
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Properties\PluginProperties;
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
return function (
string $root_dir,
array $additional_containers = array(),
array $additional_modules = array()
): ContainerInterface {
/**
* Skip path check.
*
* @psalm-suppress UnresolvableInclude
*/
$modules = ( require "$root_dir/modules.php" )( $root_dir );
$modules = array_merge( $modules, $additional_modules );
/**
* Use this filter to add custom module or remove some of existing ones.
* Modules able to access container, add services and modify existing ones.
*/
$modules = apply_filters( 'woocommerce_paypal_payments_modules', $modules );
// Initialize plugin.
$properties = PluginProperties::new( __FILE__ );
$bootstrap = Package::new( $properties );
foreach ( $modules as $module ) {
$bootstrap->addModule( $module );
}
$bootstrap->boot();
return $bootstrap->container();
};