-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.php
125 lines (102 loc) · 3.1 KB
/
config.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
declare( strict_types=1 );
/**
* Container configuration.
*
* @author Iron Bound Designs
* @since 1.0
* @copyright 2019 (c) Iron Bound Designs.
* @license GPLv2
*/
namespace TimothyBJacobs\WPMailDebugger;
use Pimple\Container;
use Psr\Container\ContainerInterface;
use TimothyBJacobs\WPMailDebugger\Infrastructure\Runner\SimpleRunner;
return [
/* App */
Plugin::class => static function ( Container $c ) {
return new Plugin(
$c[ Infrastructure\Runner\Runner::class ],
$c[ Infrastructure\VersionManager\VersionManager::class ]
);
},
App\WPMailListener::class => static function ( Container $c ) {
return new App\WPMailListener(
$c[ Domain\Email\EmailsRepository::class ]
);
},
App\AdminPage::class => static function ( Container $c ) {
return new App\AdminPage(
$c[ Infrastructure\AssetManager\AssetManager::class ]
);
},
App\REST\EmailsController::class => static function ( Container $c ) {
return new App\REST\EmailsController(
$c[ Domain\Email\EmailsRepository::class ],
$c[ Domain\Send\Sender::class ]
);
},
/* Domain */
Domain\Email\EmailsRepository::class => static function ( Container $c ) {
return $c[ Infrastructure\Email\DBTableEmailsRepository::class ];
},
Domain\Send\Sender::class => static function ( Container $c ) {
return $c[ Infrastructure\Send\WPMailSender::class ];
},
/* Infrastructure */
Infrastructure\Email\DBTableEmailsRepository::class => static function ( Container $c ) {
return new Infrastructure\Email\DBTableEmailsRepository( $GLOBALS['wpdb'] );
},
Infrastructure\Send\WPMailSender::class => static function () {
return new Infrastructure\Send\WPMailSender();
},
Infrastructure\VersionManager\VersionManager::class => static function ( Container $c ) {
return new Infrastructure\VersionManager\WPOptionVersionManager(
$c[ ContainerInterface::class ],
$c['installable'],
$c['upgradable']
);
},
Infrastructure\Runner\Runner::class => static function ( Container $c ) {
return new SimpleRunner(
$c[ ContainerInterface::class ],
$c['runnable']
);
},
Infrastructure\AssetManager\AssetManager::class => static function ( Container $c ) {
return $c[ Infrastructure\AssetManager\WPAssetManager::class ];
},
Infrastructure\AssetManager\WPAssetManager::class => static function ( Container $c ) {
return new Infrastructure\AssetManager\WPAssetManager(
$c['assets-dir'],
$c['plugin-file'],
$c['assets']
);
},
'runnable' => [
App\SettingsRegistry::class,
App\WPMailListener::class,
App\AdminPage::class,
App\REST\EmailsController::class,
Infrastructure\AssetManager\WPAssetManager::class,
],
'installable' => [
Infrastructure\Email\DBTableEmailsRepository::class,
],
'upgradable' => [
Infrastructure\Email\DBTableEmailsRepository::class,
],
'plugin-file' => __DIR__ . '/wp-mail-debugger.php',
'assets-dir' => __DIR__ . '/assets/',
'assets' => [
'entries' => [
'store' => [],
'admin-page' => [
'needs_entries' => [ 'store' ],
],
]
],
ContainerInterface::class => static function ( Container $c ) {
return new \Pimple\Psr11\Container( $c );
},
];