PluginProbe
seQura / 4.1.0
seQura v4.1.0
4.3.4 4.3.3 4.3.2 4.3.1 trunk 2.0.0 2.0.10 2.0.11 2.0.12 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 3.0.0 3.0.2 3.0.5 3.0.6 3.0.7 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 4.0.0 All 30 releases
← All changes | src/class-bootstrap.php +401 -298 3.0.24.1.0 View file →
@@ -6,10 +6,8 @@
6 6 */
7 7
8 8 namespace SeQura\WC;
9 9
10 -use SeQura\Core\BusinessLogic\AdminAPI\GeneralSettings\GeneralSettingsController;
11 -use SeQura\Core\BusinessLogic\AdminAPI\PromotionalWidgets\PromotionalWidgetsController;
12 10 use SeQura\Core\BusinessLogic\BootstrapComponent;
13 11 use SeQura\Core\BusinessLogic\DataAccess\ConnectionData\Entities\ConnectionData;
14 12 use SeQura\Core\BusinessLogic\DataAccess\OrderSettings\Entities\OrderStatusSettings;
15 13 use SeQura\Core\BusinessLogic\DataAccess\PromotionalWidgets\Entities\WidgetSettings;
@@ -16,33 +14,35 @@
16 14 use SeQura\Core\BusinessLogic\DataAccess\SendReport\Entities\SendReport;
17 15 use SeQura\Core\BusinessLogic\DataAccess\StatisticalData\Entities\StatisticalData;
18 16 use SeQura\Core\BusinessLogic\DataAccess\TransactionLog\Entities\TransactionLog;
19 17 use SeQura\Core\BusinessLogic\DataAccess\CountryConfiguration\Entities\CountryConfiguration;
18 +use SeQura\Core\BusinessLogic\DataAccess\Credentials\Entities\Credentials;
19 +use SeQura\Core\BusinessLogic\DataAccess\Deployments\Entities\Deployment;
20 20 use SeQura\Core\BusinessLogic\DataAccess\GeneralSettings\Entities\GeneralSettings;
21 +use SeQura\Core\BusinessLogic\DataAccess\PaymentMethod\Entities\PaymentMethod;
22 +use SeQura\Core\BusinessLogic\Domain\Connection\Services\ConnectionService;
23 +use SeQura\Core\BusinessLogic\Domain\Connection\Services\CredentialsService;
21 24 use SeQura\Core\BusinessLogic\Domain\CountryConfiguration\RepositoryContracts\CountryConfigurationRepositoryInterface;
22 -use SeQura\Core\BusinessLogic\Domain\GeneralSettings\RepositoryContracts\GeneralSettingsRepositoryInterface;
23 -use SeQura\Core\BusinessLogic\Domain\GeneralSettings\Services\CategoryService;
24 -use SeQura\Core\BusinessLogic\Domain\GeneralSettings\Services\GeneralSettingsService;
25 25 use SeQura\Core\BusinessLogic\Domain\Integration\Category\CategoryServiceInterface;
26 26 use SeQura\Core\BusinessLogic\Domain\Integration\Disconnect\DisconnectServiceInterface;
27 +use SeQura\Core\BusinessLogic\Domain\Integration\Order\MerchantDataProviderInterface;
28 +use SeQura\Core\BusinessLogic\Domain\Integration\Order\OrderCreationInterface;
27 29 use SeQura\Core\BusinessLogic\Domain\Integration\OrderReport\OrderReportServiceInterface;
30 +use SeQura\Core\BusinessLogic\Domain\Integration\Product\ProductServiceInterface;
28 31 use SeQura\Core\BusinessLogic\Domain\Integration\SellingCountries\SellingCountriesServiceInterface;
29 32 use SeQura\Core\BusinessLogic\Domain\Integration\ShopOrderStatuses\ShopOrderStatusesServiceInterface;
30 33 use SeQura\Core\BusinessLogic\Domain\Integration\Store\StoreServiceInterface;
31 34 use SeQura\Core\BusinessLogic\Domain\Integration\Version\VersionServiceInterface;
32 35 use SeQura\Core\BusinessLogic\Domain\Multistore\StoreContext;
33 -use SeQura\Core\BusinessLogic\Domain\Order\Models\OrderRequest\Item\AbstractItemFactory;
34 36 use SeQura\Core\BusinessLogic\Domain\Order\Models\SeQuraOrder;
35 37 use SeQura\Core\BusinessLogic\Domain\Order\RepositoryContracts\SeQuraOrderRepositoryInterface;
36 38 use SeQura\Core\BusinessLogic\Domain\OrderStatusSettings\RepositoryContracts\OrderStatusSettingsRepositoryInterface;
37 39 use SeQura\Core\BusinessLogic\Domain\OrderStatusSettings\Services\OrderStatusSettingsService;
38 -use SeQura\Core\BusinessLogic\Domain\PromotionalWidgets\RepositoryContracts\WidgetSettingsRepositoryInterface;
39 -use SeQura\Core\BusinessLogic\Domain\PromotionalWidgets\Services\WidgetSettingsService;
40 40 use SeQura\Core\BusinessLogic\Domain\StatisticalData\RepositoryContracts\StatisticalDataRepositoryInterface;
41 -use SeQura\Core\BusinessLogic\Domain\Stores\Services\StoreService;
42 41 use SeQura\Core\BusinessLogic\Utility\EncryptorInterface;
43 42 use SeQura\Core\BusinessLogic\Webhook\Services\ShopOrderService;
44 43 use SeQura\Core\Infrastructure\Configuration\ConfigEntity;
44 +use SeQura\Core\Infrastructure\Exceptions\ServiceNotRegisteredException;
45 45 use SeQura\Core\Infrastructure\Logger\Interfaces\DefaultLoggerAdapter;
46 46 use SeQura\Core\Infrastructure\Logger\Interfaces\ShopLoggerAdapter;
47 47 use SeQura\Core\Infrastructure\Logger\LoggerConfiguration;
48 48 use SeQura\Core\Infrastructure\ORM\RepositoryRegistry;
@@ -69,12 +69,10 @@
69 69 use SeQura\WC\Controllers\Rest\General_Settings_REST_Controller;
70 70 use SeQura\WC\Controllers\Rest\Log_REST_Controller;
71 71 use SeQura\WC\Controllers\Rest\Onboarding_REST_Controller;
72 72 use SeQura\WC\Controllers\Rest\Payment_REST_Controller;
73 -use SeQura\WC\Core\BusinessLogic\Domain\Order\Models\OrderRequest\Item\Item_Factory;
74 73 use SeQura\WC\Core\Extension\BusinessLogic\Domain\Order\Builders\Interface_Create_Order_Request_Builder;
75 74 use SeQura\WC\Core\Extension\BusinessLogic\Domain\OrderStatusSettings\Services\Order_Status_Settings_Service;
76 -use SeQura\WC\Core\Extension\Infrastructure\Configuration\Configuration;
77 75 use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\Category\Category_Service;
78 76 use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\Disconnect\Disconnect_Service;
79 77 use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\ShopOrderStatuses\Shop_Order_Status_Service;
80 78 use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Order\Builders\Create_Order_Request_Builder;
@@ -81,21 +79,18 @@
81 79 use SeQura\WC\Core\Implementation\BusinessLogic\Utility\Encryptor;
82 80 use SeQura\WC\Core\Implementation\BusinessLogic\Webhook\Services\Shop_Order_Service;
83 81 use SeQura\WC\Core\Implementation\Infrastructure\Logger\Interfaces\Default_Logger_Adapter;
84 82 use SeQura\WC\Core\Implementation\Infrastructure\Logger\Interfaces\Shop_Logger_Adapter;
85 -use SeQura\WC\Core\Extension\BusinessLogic\AdminAPI\GeneralSettings\General_Settings_Controller;
86 -use SeQura\WC\Core\Extension\BusinessLogic\AdminAPI\PromotionalWidgets\Promotional_Widgets_Controller;
87 -use SeQura\WC\Core\Extension\BusinessLogic\DataAccess\GeneralSettings\Repositories\General_Settings_Repository;
88 -use SeQura\WC\Core\Extension\BusinessLogic\DataAccess\PromotionalWidgets\Repositories\Widget_Settings_Repository;
89 83 use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\OrderReport\Order_Report_Service;
90 84 use SeQura\WC\Repositories\Entity_Repository;
91 85 use SeQura\WC\Repositories\Migrations\Migration_Install_300;
86 +use SeQura\WC\Repositories\Migrations\Migration_Install_320;
92 87 use SeQura\WC\Repositories\Queue_Item_Repository;
88 +use SeQura\WC\Repositories\Repository;
93 89 use SeQura\WC\Repositories\SeQura_Order_Repository;
94 -use SeQura\WC\Services\Assets\Assets;
95 -use SeQura\WC\Services\Assets\Interface_Assets;
96 90 use SeQura\WC\Services\Cart\Cart_Service;
97 91 use SeQura\WC\Services\Cart\Interface_Cart_Service;
92 +use SeQura\WC\Services\Constants\Constants;
98 93 use SeQura\WC\Services\Core\Selling_Countries_Service;
99 94 use SeQura\WC\Services\Core\Store_Service;
100 95 use SeQura\WC\Services\Core\Version_Service;
101 96 use SeQura\WC\Services\Shopper\Shopper_Service;
@@ -101,29 +96,57 @@
101 96 use SeQura\WC\Services\Shopper\Shopper_Service;
102 97 use SeQura\WC\Services\Shopper\Interface_Shopper_Service;
103 98 use SeQura\WC\Services\I18n\I18n;
104 99 use SeQura\WC\Services\I18n\Interface_I18n;
105 -use SeQura\WC\Services\Interface_Log_File;
106 -use SeQura\WC\Services\Interface_Logger_Service;
107 -use SeQura\WC\Services\Log_File;
108 -use SeQura\WC\Services\Logger_Service;
100 +use SeQura\WC\Services\Log\Interface_Log_File;
101 +use SeQura\WC\Services\Log\Interface_Logger_Service;
102 +use SeQura\WC\Services\Log\Log_File;
103 +use SeQura\WC\Services\Log\Logger_Service;
109 104 use SeQura\WC\Services\Migration\Interface_Migration_Manager;
110 105 use SeQura\WC\Services\Migration\Migration_Manager;
111 106 use SeQura\WC\Services\Order\Interface_Order_Service;
112 107 use SeQura\WC\Services\Order\Order_Service;
113 108 use SeQura\WC\Services\Payment\Interface_Payment_Method_Service;
114 -use SeQura\WC\Services\Payment\Interface_Payment_Service;
115 109 use SeQura\WC\Services\Payment\Payment_Method_Service;
116 -use SeQura\WC\Services\Payment\Payment_Service;
117 110 use SeQura\WC\Services\Payment\Sequra_Payment_Gateway_Block_Support;
118 111 use SeQura\WC\Services\Pricing\Interface_Pricing_Service;
119 112 use SeQura\WC\Services\Pricing\Pricing_Service;
120 113 use SeQura\WC\Services\Product\Interface_Product_Service;
121 114 use SeQura\WC\Services\Product\Product_Service;
122 -use SeQura\WC\Services\Regex\Interface_Regex;
123 -use SeQura\WC\Services\Regex\Regex;
124 115 use SeQura\WC\Services\Report\Interface_Report_Service;
125 116 use SeQura\WC\Services\Report\Report_Service;
117 +use SeQura\WC\Services\Constants\Interface_Constants;
118 +use SeQura\WC\Services\Time\Interface_Time_Checker_Service;
119 +use SeQura\WC\Services\Time\Time_Checker_Service;
120 +use SeQura\Core\BusinessLogic\Domain\Integration\PromotionalWidgets\WidgetConfiguratorInterface;
121 +use SeQura\Core\BusinessLogic\Domain\Integration\PromotionalWidgets\MiniWidgetMessagesProviderInterface;
122 +use SeQura\Core\BusinessLogic\Domain\Order\Builders\MerchantOrderRequestBuilder;
123 +use SeQura\Core\BusinessLogic\Domain\Order\Service\OrderService;
124 +use SeQura\Core\Infrastructure\Configuration\Configuration;
125 +use SeQura\Core\Infrastructure\Utility\RegexProvider;
126 +use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\Order\Merchant_Data_Provider;
127 +use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\Order\Order_Creation;
128 +use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\Product\Product_Service as Core_Product_Service;
129 +use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\PromotionalWidgets\Mini_Widget_Messages_Provider;
130 +use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\PromotionalWidgets\Widget_Configurator;
131 +use SeQura\WC\Repositories\Migrations\Migration_Install_400;
132 +use SeQura\WC\Services\Order\Current_Order_Provider;
133 +use SeQura\WC\Services\Order\Interface_Current_Order_Provider;
134 +use SeQura\WC\Services\Platform\Interface_Platform_Provider;
135 +use SeQura\WC\Services\Platform\Platform_Provider;
136 +use SeQura\WC\Services\Widgets\Interface_Widgets_Service;
137 +use SeQura\WC\Services\Widgets\Widgets_Service;
138 +use SeQura\Core\BusinessLogic\Domain\Integration\Store\StoreIdProvider;
139 +use SeQura\Core\Infrastructure\Configuration\ConfigurationManager;
140 +use SeQura\WC\Core\Extension\BusinessLogic\Domain\Integration\Store\Store_Id_Provider;
141 +use SeQura\WC\Services\Order\Builder\Interface_Order_Address_Builder;
142 +use SeQura\WC\Services\Order\Builder\Order_Address_Builder;
143 +use SeQura\WC\Services\Order\Builder\Interface_Order_Customer_Builder;
144 +use SeQura\WC\Services\Order\Builder\Interface_Order_Delivery_Method_Builder;
145 +use SeQura\WC\Services\Order\Builder\Order_Customer_Builder;
146 +use SeQura\WC\Services\Order\Builder\Order_Delivery_Method_Builder;
147 +use SeQura\WC\Services\Service\Interface_Settings_Service;
148 +use SeQura\WC\Services\Service\Settings_Service;
126 149
127 150 /**
128 151 * Implementation for the core bootstrap class.
129 152 */
@@ -128,8 +151,9 @@
128 151 * Implementation for the core bootstrap class.
129 152 */
130 153 class Bootstrap extends BootstrapComponent {
131 154
155 +
132 156 /**
133 157 * Cache for Service instances.
134 158 *
135 159 * @var array<string, mixed>
@@ -146,11 +170,9 @@
146 170 Reg::registerService(
147 171 Plugin::class,
148 172 static function () {
149 173 return new Plugin(
150 - Reg::getService( 'plugin.data' ),
151 - Reg::getService( 'plugin.file_path' ),
152 - Reg::getService( 'plugin.basename' ),
174 + Reg::getService( Interface_Constants::class ),
153 175 Reg::getService( Interface_Migration_Manager::class ),
154 176 Reg::getService( Interface_I18n_Controller::class ),
155 177 Reg::getService( Interface_Assets_Controller::class ),
156 178 Reg::getService( Interface_Settings_Controller::class ),
@@ -171,105 +193,28 @@
171 193 * Initializes constants.
172 194 */
173 195 public static function initConstants(): void {
174 196 Reg::registerService(
175 - 'plugin.dir_path',
197 + Interface_Constants::class,
176 198 static function () {
177 - if ( ! isset( self::$cache['plugin.dir_path'] ) ) {
178 - self::$cache['plugin.dir_path'] = trailingslashit( dirname( __DIR__, 1 ) );
179 - }
180 - return self::$cache['plugin.dir_path'];
181 - }
182 - );
183 - Reg::registerService(
184 - 'plugin.file_path',
185 - static function () {
186 - if ( ! isset( self::$cache['plugin.file_path'] ) ) {
187 - self::$cache['plugin.file_path'] = Reg::getService( 'plugin.dir_path' ) . 'sequra.php';
188 - }
189 - return self::$cache['plugin.file_path'];
190 - }
191 - );
192 - Reg::registerService(
193 - 'plugin.log_file_path',
194 - static function () {
195 - if ( ! isset( self::$cache['plugin.log_file_path'] ) ) {
196 - self::$cache['plugin.log_file_path'] = Reg::getService( 'plugin.dir_path' ) . 'sequra.{storeId}.log';
197 - }
198 - return self::$cache['plugin.log_file_path'];
199 - }
200 - );
201 199
202 - Reg::registerService(
203 - 'plugin.basename',
204 - static function () {
205 - if ( ! isset( self::$cache['plugin.basename'] ) ) {
206 - self::$cache['plugin.basename'] = plugin_basename( Reg::getService( 'plugin.dir_path' ) . 'sequra.php' );
207 - }
208 - return self::$cache['plugin.basename'];
209 - }
210 - );
200 + if ( ! isset( self::$cache[ Interface_Constants::class ] ) ) {
201 + $dir_path = \trailingslashit( dirname( __DIR__, 1 ) );
202 + $plugin_file_path = $dir_path . 'sequra.php';
211 203
212 - Reg::registerService(
213 - 'plugin.dir_url',
214 - static function () {
215 - if ( ! isset( self::$cache['plugin.dir_url'] ) ) {
216 - self::$cache['plugin.dir_url'] = plugin_dir_url( Reg::getService( 'plugin.file_path' ) );
217 - }
218 - return self::$cache['plugin.dir_url'];
219 - }
220 - );
221 -
222 - Reg::registerService(
223 - 'plugin.rest_namespace',
224 - static function () {
225 - if ( ! isset( self::$cache['plugin.rest_namespace'] ) ) {
226 - self::$cache['plugin.rest_namespace'] = 'sequra/v1';
227 - }
228 - return self::$cache['plugin.rest_namespace'];
229 - }
230 - );
231 -
232 - Reg::registerService(
233 - 'woocommerce.data',
234 - static function () {
235 - if ( ! isset( self::$cache['woocommerce.data'] ) ) {
236 204 if ( ! function_exists( 'get_plugin_data' ) ) {
237 205 require_once ABSPATH . 'wp-admin/includes/plugin.php';
238 206 }
239 - self::$cache['woocommerce.data'] = get_plugin_data( WP_PLUGIN_DIR . '/woocommerce/woocommerce.php' );
240 - }
241 - return self::$cache['woocommerce.data'];
242 - }
243 - );
244 -
245 - Reg::registerService(
246 - 'plugin.data',
247 - static function () {
248 - if ( ! isset( self::$cache['plugin.data'] ) ) {
249 - if ( ! function_exists( 'get_plugin_data' ) ) {
250 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
251 - }
252 207 $add_wc_headers = function ( $headers ) {
253 208 $headers['WC requires at least'] = 'WC requires at least';
254 209 return $headers;
255 210 };
256 - add_filter( 'extra_plugin_headers', $add_wc_headers );
257 - $data = get_plugin_data( Reg::getService( 'plugin.file_path' ) );
258 - remove_filter( 'extra_plugin_headers', $add_wc_headers );
211 + \add_filter( 'extra_plugin_headers', $add_wc_headers );
212 + $data = \get_plugin_data( $plugin_file_path, true, false );
213 + \remove_filter( 'extra_plugin_headers', $add_wc_headers );
259 214 $data['RequiresWC'] = $data['WC requires at least'];
260 215 unset( $data['WC requires at least'] );
261 216
262 - self::$cache['plugin.data'] = $data;
263 - }
264 - return self::$cache['plugin.data'];
265 - }
266 - );
267 -
268 - Reg::registerService(
269 - 'environment.data',
270 - static function () {
271 - if ( ! isset( self::$cache['environment.data'] ) ) {
272 217 /**
273 218 * Database instance.
274 219 *
275 220 * @var \wpdb $wpdb
@@ -274,48 +219,50 @@
274 219 *
275 220 * @var \wpdb $wpdb
276 221 */
277 222 $wpdb = Reg::getService( \wpdb::class );
278 -
279 - self::$cache['environment.data'] = array(
223 + global $wp_version;
224 +
225 + $environment_data = array(
280 226 'php_version' => phpversion(),
281 227 'php_os' => PHP_OS,
282 228 'uname' => php_uname(),
283 229 'db_name' => false === strpos( strtolower( $wpdb->db_server_info() ), 'mariadb' ) ? 'mysql' : 'mariadb',
284 230 'db_version' => $wpdb->db_version() ?? '',
231 + 'wp_version' => strval( $wp_version ),
285 232 );
233 +
234 + $dir_url = \plugin_dir_url( $plugin_file_path );
235 +
236 + self::$cache[ Interface_Constants::class ] = new Constants(
237 + $dir_path,
238 + $plugin_file_path,
239 + $dir_path . 'sequra.{storeId}.log',
240 + \plugin_basename( $plugin_file_path ),
241 + $dir_url,
242 + 'sequra/v1',
243 + $data,
244 + \get_plugin_data( WP_PLUGIN_DIR . '/woocommerce/woocommerce.php', true, false ),
245 + $environment_data,
246 + $dir_path . 'templates/',
247 + $dir_path . 'assets',
248 + \untrailingslashit( $dir_url ) . '/assets'
249 + );
286 250 }
287 - return self::$cache['environment.data'];
251 +
252 + return self::$cache[ Interface_Constants::class ];
288 253 }
289 254 );
255 + }
290 256
291 - Reg::registerService(
292 - 'plugin.templates_path',
293 - static function () {
294 - if ( ! isset( self::$cache['plugin.templates_path'] ) ) {
295 - self::$cache['plugin.templates_path'] = Reg::getService( 'plugin.dir_path' ) . 'templates/';
296 - }
297 - return self::$cache['plugin.templates_path'];
298 - }
299 - );
300 - Reg::registerService(
301 - 'plugin.assets_path',
302 - static function () {
303 - if ( ! isset( self::$cache['plugin.assets_path'] ) ) {
304 - self::$cache['plugin.assets_path'] = Reg::getService( 'plugin.dir_path' ) . 'assets';
305 - }
306 - return self::$cache['plugin.assets_path'];
307 - }
308 - );
309 - Reg::registerService(
310 - 'plugin.assets_url',
311 - static function () {
312 - if ( ! isset( self::$cache['plugin.assets_url'] ) ) {
313 - self::$cache['plugin.assets_url'] = untrailingslashit( Reg::getService( 'plugin.dir_url' ) ) . '/assets';
314 - }
315 - return self::$cache['plugin.assets_url'];
316 - }
317 - );
257 + /**
258 + * Get the constants instance.
259 + *
260 + * @return Interface_Constants
261 + * @throws ServiceNotRegisteredException
262 + */
263 + private static function get_constants() {
264 + return Reg::getService( Interface_Constants::class );
318 265 }
319 266
320 267 /**
321 268 * Initializes services and utilities.
@@ -324,9 +271,9 @@
324 271 parent::initServices();
325 272
326 273 // Core Default.
327 274 Reg::registerService(
328 - LoggerConfiguration::class,
275 + LoggerConfiguration::class,
329 276 static function () {
330 277 if ( ! isset( self::$cache[ LoggerConfiguration::class ] ) ) {
331 278 $loggerConfig = LoggerConfiguration::getInstance();
332 279 if ( ! $loggerConfig->isDefaultLoggerEnabled() ) {
@@ -356,50 +303,58 @@
356 303 static function () {
357 304 return Reg::getService( Order_Status_Settings_Service::class );
358 305 }
359 306 );
307 + // Extend Configuration.
360 308 Reg::registerService(
361 309 Configuration::class,
362 310 static function () {
363 311 if ( ! isset( self::$cache[ Configuration::class ] ) ) {
364 - self::$cache[ Configuration::class ] = Configuration::getInstance();
312 + self::$cache[ Configuration::class ] = \SeQura\WC\Core\Extension\Infrastructure\Configuration\Configuration::getInstance();
365 313 }
366 314 return self::$cache[ Configuration::class ];
367 315 }
368 316 );
317 +
318 + /**
319 + * Initialize StoreContext with default store ID so any service that depends on StoreContext
320 + * will have the correct store ID set from the beginning. This will reduce the StoreContext::doWithStore
321 + * calls to the cases where it's really necessary to set a different store ID.
322 + */
369 323 Reg::registerService(
370 - \SeQura\Core\Infrastructure\Configuration\Configuration::CLASS_NAME,
324 + StoreIdProvider::class,
371 325 static function () {
372 - return Reg::getService( Configuration::class );
326 + if ( ! isset( self::$cache[ StoreIdProvider::class ] ) ) {
327 + self::$cache[ StoreIdProvider::class ] = new Store_Id_Provider();
328 + }
329 + return self::$cache[ StoreIdProvider::class ];
373 330 }
374 331 );
332 +
375 333 Reg::registerService(
376 334 Interface_Create_Order_Request_Builder::class,
377 335 static function () {
378 336 if ( ! isset( self::$cache[ Interface_Create_Order_Request_Builder::class ] ) ) {
379 337 self::$cache[ Interface_Create_Order_Request_Builder::class ] = new Create_Order_Request_Builder(
380 - Reg::getService( Interface_Payment_Service::class ),
381 338 Reg::getService( Interface_Cart_Service::class ),
382 - Reg::getService( Configuration::class ),
339 + Reg::getService( Interface_Platform_Provider::class ),
383 340 Reg::getService( Interface_Product_Service::class ),
384 341 Reg::getService( Interface_Order_Service::class ),
385 342 Reg::getService( Interface_I18n::class ),
386 343 Reg::getService( Interface_Shopper_Service::class ),
387 - Reg::getService( Interface_Logger_Service::class )
344 + Reg::getService( Interface_Logger_Service::class ),
345 + Reg::getService( Interface_Current_Order_Provider::class ),
346 + Reg::getService( MerchantOrderRequestBuilder::class ),
347 + Reg::getService( Interface_Order_Delivery_Method_Builder::class ),
348 + Reg::getService( Interface_Order_Address_Builder::class ),
349 + Reg::getService( Interface_Order_Customer_Builder::class ),
350 + Reg::getService( CredentialsService::class ),
351 + Reg::getService( SeQuraOrderRepositoryInterface::class )
388 352 );
389 353 }
390 354 return self::$cache[ Interface_Create_Order_Request_Builder::class ];
391 355 }
392 356 );
393 - Reg::registerService(
394 - AbstractItemFactory::class,
395 - static function () {
396 - if ( ! isset( self::$cache[ AbstractItemFactory::class ] ) ) {
397 - self::$cache[ AbstractItemFactory::class ] = new Item_Factory();
398 - }
399 - return self::$cache[ AbstractItemFactory::class ];
400 - }
401 - );
402 357
403 358 // Core Implementation.
404 359 Reg::registerService(
405 360 EncryptorInterface::class,
@@ -419,10 +374,8 @@
419 374 RepositoryRegistry::getRepository( ConnectionData::class ),
420 375 RepositoryRegistry::getRepository( StatisticalData::class ),
421 376 RepositoryRegistry::getRepository( SendReport::class ),
422 377 RepositoryRegistry::getRepository( QueueItem::class ),
423 - //phpcs:ignore
424 - // RepositoryRegistry::getRepository( SeQuraOrder::class ),
425 378 )
426 379 );
427 380 }
428 381 return self::$cache[ DisconnectServiceInterface::class ];
@@ -432,18 +385,46 @@
432 385 OrderReportServiceInterface::class,
433 386 static function () {
434 387 if ( ! isset( self::$cache[ OrderReportServiceInterface::class ] ) ) {
435 388 self::$cache[ OrderReportServiceInterface::class ] = new Order_Report_Service(
436 - Reg::getService( Configuration::CLASS_NAME ),
389 + Reg::getService( Interface_Platform_Provider::class ),
437 390 Reg::getService( Interface_Pricing_Service::class ),
438 391 Reg::getService( Interface_Cart_Service::class ),
439 392 Reg::getService( Interface_Order_Service::class ),
440 - Reg::getService( Interface_I18n::class )
393 + Reg::getService( Interface_I18n::class ),
394 + Reg::getService( Interface_Order_Delivery_Method_Builder::class ),
395 + Reg::getService( Interface_Order_Address_Builder::class ),
396 + Reg::getService( Interface_Order_Customer_Builder::class )
441 397 );
442 398 }
443 399 return self::$cache[ OrderReportServiceInterface::class ];
444 400 }
445 401 );
402 + Reg::registerService(
403 + MerchantDataProviderInterface::class,
404 + static function () {
405 + if ( ! isset( self::$cache[ MerchantDataProviderInterface::class ] ) ) {
406 + self::$cache[ MerchantDataProviderInterface::class ] = new Merchant_Data_Provider(
407 + Reg::getService( Interface_Current_Order_Provider::class ),
408 + Reg::getService( Interface_Constants::class ),
409 + Reg::getService( Interface_Product_Service::class ),
410 + Reg::getService( Interface_Cart_Service::class ),
411 + Reg::getService( Interface_Shopper_Service::class ),
412 + Reg::getService( StoreContext::class )
413 + );
414 + }
415 + return self::$cache[ MerchantDataProviderInterface::class ];
416 + }
417 + );
418 + Reg::registerService(
419 + OrderCreationInterface::class,
420 + static function () {
421 + if ( ! isset( self::$cache[ OrderCreationInterface::class ] ) ) {
422 + self::$cache[ OrderCreationInterface::class ] = new Order_Creation();
423 + }
424 + return self::$cache[ OrderCreationInterface::class ];
425 + }
426 + );
446 427
447 428
448 429 Reg::registerService(
449 430 Serializer::class,
@@ -476,9 +457,9 @@
476 457 VersionServiceInterface::class,
477 458 static function () {
478 459 if ( ! isset( self::$cache[ VersionServiceInterface::class ] ) ) {
479 460 self::$cache[ VersionServiceInterface::class ] = new Version_Service(
480 - Reg::getService( 'plugin.data' )['Version']
461 + self::get_constants()->get_plugin_data()['Version']
481 462 );
482 463 }
483 464 return self::$cache[ VersionServiceInterface::class ];
484 465 }
@@ -528,9 +509,10 @@
528 509 Interface_Log_File::class,
529 510 static function () {
530 511 if ( ! isset( self::$cache[ Interface_Log_File::class ] ) ) {
531 512 self::$cache[ Interface_Log_File::class ] = new Log_File(
532 - Reg::getService( 'plugin.log_file_path' )
513 + self::get_constants()->get_plugin_log_file_path(),
514 + Reg::getService( StoreContext::class )
533 515 );
534 516 }
535 517 return self::$cache[ Interface_Log_File::class ];
536 518 }
@@ -538,17 +520,66 @@
538 520 Reg::registerService(
539 521 Interface_Migration_Manager::class,
540 522 static function () {
541 523 if ( ! isset( self::$cache[ Interface_Migration_Manager::class ] ) ) {
524 + $configuration = Reg::getService( ConfigurationManager::CLASS_NAME );
525 + $wpdb = Reg::getService( \wpdb::class );
526 + /**
527 + * Order repository.
528 + *
529 + * @var Repository $order_repository
530 + */
531 + $order_repository = RepositoryRegistry::getRepository( SeQuraOrder::class );
532 + /**
533 + * Entity repository.
534 + *
535 + * @var Repository $entity_repository
536 + */
537 + $entity_repository = RepositoryRegistry::getRepository( ConfigEntity::class );
538 +
539 + /**
540 + * Queue item repository.
541 + *
542 + * @var Repository $queue_item_repository
543 + */
544 + $queue_item_repository = RepositoryRegistry::getRepository( QueueItem::class );
545 + /**
546 + * Encryptor service.
547 + *
548 + * @var EncryptorInterface $encryptor
549 + */
550 + $encryptor = Reg::getService( EncryptorInterface::class );
551 +
552 + /**
553 + * Store context service.
554 + *
555 + * @var StoreContext $store_context
556 + */
557 + $store_context = Reg::getService( StoreContext::class );
558 +
542 559 self::$cache[ Interface_Migration_Manager::class ] = new Migration_Manager(
543 - Reg::getService( 'plugin.basename' ),
544 - Reg::getService( Configuration::CLASS_NAME ),
545 - Reg::getService( 'plugin.data' )['Version'],
560 + self::get_constants()->get_plugin_basename(),
561 + $configuration,
562 + self::get_constants()->get_plugin_data()['Version'],
546 563 array(
547 - new Migration_Install_300(
548 - Reg::getService( \wpdb::class ),
549 - Reg::getService( Configuration::CLASS_NAME )
564 + new Migration_Install_300(
565 + $wpdb,
566 + $order_repository,
567 + $entity_repository,
568 + $queue_item_repository,
569 + $store_context
550 570 ),
571 + new Migration_Install_320(
572 + $wpdb,
573 + self::get_constants()->get_hook_add_order_indexes(),
574 + $entity_repository,
575 + $queue_item_repository
576 + ),
577 + new Migration_Install_400(
578 + $wpdb,
579 + $encryptor,
580 + $store_context,
581 + ),
551 582 )
552 583 );
553 584 }
554 585 return self::$cache[ Interface_Migration_Manager::class ];
@@ -563,28 +594,16 @@
563 594 return self::$cache[ Interface_I18n::class ];
564 595 }
565 596 );
566 597 Reg::registerService(
567 - Interface_Regex::class,
568 - static function () {
569 - if ( ! isset( self::$cache[ Interface_Regex::class ] ) ) {
570 - self::$cache[ Interface_Regex::class ] = new Regex();
571 - }
572 - return self::$cache[ Interface_Regex::class ];
573 - }
574 - );
575 - Reg::registerService(
576 598 Interface_Report_Service::class,
577 599 static function () {
578 600 if ( ! isset( self::$cache[ Interface_Report_Service::class ] ) ) {
579 601 self::$cache[ Interface_Report_Service::class ] = new Report_Service(
580 - Reg::getService( Configuration::class ),
581 - Reg::getService( StoreService::class ),
582 602 Reg::getService( ShopOrderService::class ),
583 603 Reg::getService( StatisticalDataRepositoryInterface::class ),
584 604 Reg::getService( CountryConfigurationRepositoryInterface::class ),
585 - Reg::getService( Interface_Order_Service::class ),
586 - Reg::getService( StoreContext::class )
605 + Reg::getService( Interface_Order_Service::class )
587 606 );
588 607 }
589 608 return self::$cache[ Interface_Report_Service::class ];
590 609 }
@@ -600,28 +619,17 @@
600 619 }
601 620 return self::$cache[ Interface_Logger_Service::class ];
602 621 }
603 622 );
623 +
604 624 Reg::registerService(
605 - Interface_Payment_Service::class,
606 - static function () {
607 - if ( ! isset( self::$cache[ Interface_Payment_Service::class ] ) ) {
608 - self::$cache[ Interface_Payment_Service::class ] = new Payment_Service(
609 - Reg::getService( Configuration::class ),
610 - Reg::getService( Interface_I18n::class )
611 - );
612 - }
613 - return self::$cache[ Interface_Payment_Service::class ];
614 - }
615 - );
616 - Reg::registerService(
617 625 Sequra_Payment_Gateway_Block_Support::class,
618 626 static function () {
619 627 if ( ! isset( self::$cache[ Sequra_Payment_Gateway_Block_Support::class ] ) ) {
620 628 self::$cache[ Sequra_Payment_Gateway_Block_Support::class ] = new Sequra_Payment_Gateway_Block_Support(
621 - Reg::getService( 'plugin.assets_path' ),
622 - Reg::getService( 'plugin.assets_url' ),
623 - Reg::getService( 'plugin.data' )['Version']
629 + self::get_constants()->get_plugin_assets_path(),
630 + self::get_constants()->get_plugin_assets_url(),
631 + self::get_constants()->get_plugin_data()['Version']
624 632 );
625 633 }
626 634 return self::$cache[ Sequra_Payment_Gateway_Block_Support::class ];
627 635 }
@@ -638,15 +646,27 @@
638 646 Reg::registerService(
639 647 Interface_Order_Service::class,
640 648 static function () {
641 649 if ( ! isset( self::$cache[ Interface_Order_Service::class ] ) ) {
650 + /**
651 + * This will return SeQura_Order_Repository that implements Interface_Deletable_Repository and Interface_Table_Migration_Repository.
652 + *
653 + * @var SeQura_Order_Repository $repository
654 + */
655 + $repository = RepositoryRegistry::getRepository( SeQuraOrder::class );
656 +
642 657 self::$cache[ Interface_Order_Service::class ] = new Order_Service(
643 - Reg::getService( Interface_Payment_Service::class ),
658 + Reg::getService( SeQuraOrderRepositoryInterface::class ),
644 659 Reg::getService( Interface_Pricing_Service::class ),
645 660 Reg::getService( OrderStatusSettingsService::class ),
646 - Reg::getService( Configuration::class ),
647 661 Reg::getService( Interface_Cart_Service::class ),
648 - Reg::getService( StoreContext::class )
662 + Reg::getService( Interface_Logger_Service::class ),
663 + Reg::getService( Interface_Time_Checker_Service::class ),
664 + $repository,
665 + $repository,
666 + self::get_constants()->get_payment_gateway_id(),
667 + Reg::getService( ConnectionService::class ),
668 + Reg::getService( OrderService::class )
649 669 );
650 670 }
651 671 return self::$cache[ Interface_Order_Service::class ];
652 672 }
@@ -656,11 +676,11 @@
656 676 static function () {
657 677 if ( ! isset( self::$cache[ Interface_Cart_Service::class ] ) ) {
658 678 self::$cache[ Interface_Cart_Service::class ] = new Cart_Service(
659 679 Reg::getService( Interface_Product_Service::class ),
660 - Reg::getService( Configuration::class ),
661 680 Reg::getService( Interface_Pricing_Service::class ),
662 - Reg::getService( Interface_Logger_Service::class )
681 + Reg::getService( Interface_Logger_Service::class ),
682 + Reg::getService( Interface_Shopper_Service::class )
663 683 );
664 684 }
665 685 return self::$cache[ Interface_Cart_Service::class ];
666 686 }
@@ -669,11 +689,11 @@
669 689 Interface_Product_Service::class,
670 690 static function () {
671 691 if ( ! isset( self::$cache[ Interface_Product_Service::class ] ) ) {
672 692 self::$cache[ Interface_Product_Service::class ] = new Product_Service(
673 - Reg::getService( Configuration::class ),
674 693 Reg::getService( Interface_Pricing_Service::class ),
675 - Reg::getService( Interface_Regex::class )
694 + Reg::getService( RegexProvider::class ),
695 + Reg::getService( StoreContext::class )
676 696 );
677 697 }
678 698 return self::$cache[ Interface_Product_Service::class ];
679 699 }
@@ -681,9 +701,11 @@
681 701 Reg::registerService(
682 702 Interface_Shopper_Service::class,
683 703 static function () {
684 704 if ( ! isset( self::$cache[ Interface_Shopper_Service::class ] ) ) {
685 - self::$cache[ Interface_Shopper_Service::class ] = new Shopper_Service();
705 + self::$cache[ Interface_Shopper_Service::class ] = new Shopper_Service(
706 + Reg::getService( StoreContext::class )
707 + );
686 708 }
687 709 return self::$cache[ Interface_Shopper_Service::class ];
688 710 }
689 711 );
@@ -692,9 +714,12 @@
692 714 static function () {
693 715 if ( ! isset( self::$cache[ ShopOrderService::class ] ) ) {
694 716 self::$cache[ ShopOrderService::class ] = new Shop_Order_Service(
695 717 Reg::getService( SeQuraOrderRepositoryInterface::class ),
696 - Reg::getService( Interface_Logger_Service::class )
718 + Reg::getService( Interface_Logger_Service::class ),
719 + Reg::getService( Interface_Create_Order_Request_Builder::class ),
720 + Reg::getService( Interface_Current_Order_Provider::class ),
721 + Reg::getService( OrderService::class )
697 722 );
698 723 }
699 724 return self::$cache[ ShopOrderService::class ];
700 725 }
@@ -699,16 +724,145 @@
699 724 return self::$cache[ ShopOrderService::class ];
700 725 }
701 726 );
702 727 Reg::registerService(
703 - Interface_Assets::class,
728 + Interface_Time_Checker_Service::class,
704 729 static function () {
705 - if ( ! isset( self::$cache[ Interface_Assets::class ] ) ) {
706 - self::$cache[ Interface_Assets::class ] = new Assets();
730 + if ( ! isset( self::$cache[ Interface_Time_Checker_Service::class ] ) ) {
731 + self::$cache[ Interface_Time_Checker_Service::class ] = new Time_Checker_Service();
707 732 }
708 - return self::$cache[ Interface_Assets::class ];
733 + return self::$cache[ Interface_Time_Checker_Service::class ];
709 734 }
710 735 );
736 +
737 + Reg::registerService(
738 + ProductServiceInterface::class,
739 + static function () {
740 + if ( ! isset( self::$cache[ ProductServiceInterface::class ] ) ) {
741 + self::$cache[ ProductServiceInterface::class ] = new Core_Product_Service();
742 + }
743 + return self::$cache[ ProductServiceInterface::class ];
744 + }
745 + );
746 + Reg::registerService(
747 + WidgetConfiguratorInterface::class,
748 + static function () {
749 + if ( ! isset( self::$cache[ WidgetConfiguratorInterface::class ] ) ) {
750 + self::$cache[ WidgetConfiguratorInterface::class ] = new Widget_Configurator(
751 + Reg::getService( Interface_I18n::class )
752 + );
753 + }
754 + return self::$cache[ WidgetConfiguratorInterface::class ];
755 + }
756 + );
757 +
758 + Reg::registerService(
759 + MiniWidgetMessagesProviderInterface::class,
760 + static function () {
761 + if ( ! isset( self::$cache[ MiniWidgetMessagesProviderInterface::class ] ) ) {
762 + self::$cache[ MiniWidgetMessagesProviderInterface::class ] = new Mini_Widget_Messages_Provider(
763 + Reg::getService( Interface_I18n::class )
764 + );
765 + }
766 + return self::$cache[ MiniWidgetMessagesProviderInterface::class ];
767 + }
768 + );
769 +
770 + Reg::registerService(
771 + Interface_Current_Order_Provider::class,
772 + static function () {
773 + if ( ! isset( self::$cache[ Interface_Current_Order_Provider::class ] ) ) {
774 + self::$cache[ Interface_Current_Order_Provider::class ] = new Current_Order_Provider();
775 + }
776 + return self::$cache[ Interface_Current_Order_Provider::class ];
777 + }
778 + );
779 +
780 + Reg::registerService(
781 + Interface_Platform_Provider::class,
782 + static function () {
783 + if ( ! isset( self::$cache[ Interface_Platform_Provider::class ] ) ) {
784 + self::$cache[ Interface_Platform_Provider::class ] = new Platform_Provider(
785 + Reg::getService( Interface_Constants::class )
786 + );
787 + }
788 + return self::$cache[ Interface_Platform_Provider::class ];
789 + }
790 + );
791 +
792 + Reg::registerService(
793 + Interface_Payment_Method_Service::class,
794 + static function () {
795 + if ( ! isset( self::$cache[ Interface_Payment_Method_Service::class ] ) ) {
796 + self::$cache[ Interface_Payment_Method_Service::class ] = new Payment_Method_Service(
797 + Reg::getService( Interface_Create_Order_Request_Builder::class ),
798 + Reg::getService( Interface_Order_Service::class ),
799 + Reg::getService( Interface_Logger_Service::class ),
800 + Reg::getService( Interface_Current_Order_Provider::class ),
801 + Reg::getService( StoreContext::class )
802 + );
803 + }
804 + return self::$cache[ Interface_Payment_Method_Service::class ];
805 + }
806 + );
807 +
808 + Reg::registerService(
809 + Interface_Widgets_Service::class,
810 + static function () {
811 + if ( ! isset( self::$cache[ Interface_Widgets_Service::class ] ) ) {
812 + self::$cache[ Interface_Widgets_Service::class ] = new Widgets_Service(
813 + Reg::getService( Interface_Logger_Service::class ),
814 + Reg::getService( Interface_I18n::class ),
815 + Reg::getService( Interface_Shopper_Service::class ),
816 + Reg::getService( WidgetConfiguratorInterface::class ),
817 + Reg::getService( StoreContext::class )
818 + );
819 + }
820 + return self::$cache[ Interface_Widgets_Service::class ];
821 + }
822 + );
823 + Reg::registerService(
824 + Interface_Settings_Service::class,
825 + static function () {
826 + if ( ! isset( self::$cache[ Interface_Settings_Service::class ] ) ) {
827 + self::$cache[ Interface_Settings_Service::class ] = new Settings_Service();
828 + }
829 + return self::$cache[ Interface_Settings_Service::class ];
830 + }
831 + );
832 + Reg::registerService(
833 + Interface_Order_Address_Builder::class,
834 + static function () {
835 + if ( ! isset( self::$cache[ Interface_Order_Address_Builder::class ] ) ) {
836 + self::$cache[ Interface_Order_Address_Builder::class ] = new Order_Address_Builder(
837 + Reg::getService( Interface_Shopper_Service::class )
838 + );
839 + }
840 + return self::$cache[ Interface_Order_Address_Builder::class ];
841 + }
842 + );
843 + Reg::registerService(
844 + Interface_Order_Customer_Builder::class,
845 + static function () {
846 + if ( ! isset( self::$cache[ Interface_Order_Customer_Builder::class ] ) ) {
847 + self::$cache[ Interface_Order_Customer_Builder::class ] = new Order_Customer_Builder(
848 + Reg::getService( Interface_Shopper_Service::class ),
849 + Reg::getService( OrderStatusSettingsService::class ),
850 + Reg::getService( Interface_Pricing_Service::class )
851 + );
852 + }
853 + return self::$cache[ Interface_Order_Customer_Builder::class ];
854 + }
855 + );
856 + Reg::registerService(
857 + Interface_Order_Delivery_Method_Builder::class,
858 + static function () {
859 + if ( ! isset( self::$cache[ Interface_Order_Delivery_Method_Builder::class ] ) ) {
860 + self::$cache[ Interface_Order_Delivery_Method_Builder::class ] = new Order_Delivery_Method_Builder();
861 + }
862 + return self::$cache[ Interface_Order_Delivery_Method_Builder::class ];
863 + }
864 + );
711 865 }
712 866
713 867 /**
714 868 * Initializes repositories.
@@ -727,30 +881,8 @@
727 881 );
728 882
729 883 parent::initRepositories();
730 884
731 - // Extend GeneralSettingsRepository.
732 - Reg::registerService(
733 - GeneralSettingsRepositoryInterface::class,
734 - static function () {
735 - return new General_Settings_Repository(
736 - RepositoryRegistry::getRepository( GeneralSettings::getClassName() ),
737 - Reg::getService( StoreContext::class )
738 - );
739 - }
740 - );
741 -
742 - // Extend WidgetSettingsRepository.
743 - Reg::registerService(
744 - WidgetSettingsRepositoryInterface::class,
745 - static function () {
746 - return new Widget_Settings_Repository(
747 - RepositoryRegistry::getRepository( WidgetSettings::getClassName() ),
748 - Reg::getService( StoreContext::class )
749 - );
750 - }
751 - );
752 -
753 885 RepositoryRegistry::registerRepository( ConfigEntity::class, Entity_Repository::class );
754 886 RepositoryRegistry::registerRepository( QueueItem::class, Queue_Item_Repository::class );
755 887 RepositoryRegistry::registerRepository( Process::class, Entity_Repository::class );
756 888 RepositoryRegistry::registerRepository( ConnectionData::class, Entity_Repository::class );
@@ -761,8 +893,11 @@
761 893 RepositoryRegistry::registerRepository( SeQuraOrder::class, SeQura_Order_Repository::class );
762 894 RepositoryRegistry::registerRepository( WidgetSettings::class, Entity_Repository::class );
763 895 RepositoryRegistry::registerRepository( SendReport::class, Entity_Repository::class );
764 896 RepositoryRegistry::registerRepository( TransactionLog::class, Entity_Repository::class );
897 + RepositoryRegistry::registerRepository( PaymentMethod::class, Entity_Repository::class );
898 + RepositoryRegistry::registerRepository( Credentials::class, Entity_Repository::class );
899 + RepositoryRegistry::registerRepository( Deployment::class, Entity_Repository::class );
765 900 }
766 901
767 902 /**
768 903 * Initializes controllers.
@@ -769,41 +904,20 @@
769 904 */
770 905 protected static function initControllers(): void {
771 906 parent::initControllers();
772 907
773 - // Extend GeneralSettingsController.
774 - Reg::registerService(
775 - GeneralSettingsController::class,
776 - static function () {
777 - return new General_Settings_Controller(
778 - Reg::getService( GeneralSettingsService::class ),
779 - Reg::getService( CategoryService::class )
780 - );
781 - }
782 - );
783 -
784 - // Extend PromotionalWidgetsController.
785 - Reg::registerService(
786 - PromotionalWidgetsController::class,
787 - static function () {
788 - return new Promotional_Widgets_Controller(
789 - Reg::getService( WidgetSettingsService::class )
790 - );
791 - }
792 - );
793 -
794 908 // Plugin controllers.
795 909 Reg::registerService(
796 910 Interface_I18n_Controller::class,
797 911 static function () {
798 912 if ( ! isset( self::$cache[ Interface_I18n_Controller::class ] ) ) {
799 - $data = Reg::getService( 'plugin.data' );
913 + $data = self::get_constants()->get_plugin_data();
800 914 $domain = $data['TextDomain'];
801 - self::$cache[ Interface_I18n_Controller::class ] = new I18n_Controller(
915 + self::$cache[ Interface_I18n_Controller::class ] = new I18n_Controller(
802 916 $domain . $data['DomainPath'],
803 917 $domain,
804 918 Reg::getService( Interface_Logger_Service::class ),
805 - Reg::getService( 'plugin.templates_path' )
919 + self::get_constants()->get_plugin_templates_path()
806 920 );
807 921 }
808 922 return self::$cache[ Interface_I18n_Controller::class ];
809 923 }
@@ -811,19 +925,21 @@
811 925 Reg::registerService(
812 926 Interface_Assets_Controller::class,
813 927 static function () {
814 928 if ( ! isset( self::$cache[ Interface_Assets_Controller::class ] ) ) {
929 + $env_data = self::get_constants()->get_environment_data();
815 930 self::$cache[ Interface_Assets_Controller::class ] = new Assets_Controller(
816 - Reg::getService( 'plugin.assets_url' ),
817 - Reg::getService( 'plugin.assets_path' ),
818 - Reg::getService( 'plugin.data' )['Version'],
931 + self::get_constants()->get_plugin_assets_url(),
932 + self::get_constants()->get_plugin_assets_path(),
933 + self::get_constants()->get_plugin_data()['Version'],
934 + $env_data['wp_version'] ?? '',
819 935 Reg::getService( Interface_I18n::class ),
820 936 Reg::getService( Interface_Logger_Service::class ),
821 - Reg::getService( 'plugin.templates_path' ),
822 - Reg::getService( Configuration::class ),
823 - Reg::getService( Interface_Assets::class ),
937 + self::get_constants()->get_plugin_templates_path(),
938 + Reg::getService( Interface_Settings_Service::class ),
824 939 Reg::getService( Interface_Payment_Method_Service::class ),
825 - Reg::getService( Interface_Regex::class )
940 + Reg::getService( RegexProvider::class ),
941 + Reg::getService( Interface_Widgets_Service::class )
826 942 );
827 943 }
828 944 return self::$cache[ Interface_Assets_Controller::class ];
829 945 }
@@ -832,12 +948,12 @@
832 948 Interface_Settings_Controller::class,
833 949 static function () {
834 950 if ( ! isset( self::$cache[ Interface_Settings_Controller::class ] ) ) {
835 951 self::$cache[ Interface_Settings_Controller::class ] = new Settings_Controller(
836 - Reg::getService( 'plugin.templates_path' ),
837 - Reg::getService( Configuration::class ),
952 + self::get_constants()->get_plugin_templates_path(),
953 + Reg::getService( Interface_Settings_Service::class ),
838 954 Reg::getService( Interface_Logger_Service::class ),
839 - Reg::getService( 'plugin.basename' )
955 + self::get_constants()->get_plugin_basename()
840 956 );
841 957 }
842 958 return self::$cache[ Interface_Settings_Controller::class ];
843 959 }
@@ -847,9 +963,9 @@
847 963 static function () {
848 964 if ( ! isset( self::$cache[ Interface_Payment_Controller::class ] ) ) {
849 965 self::$cache[ Interface_Payment_Controller::class ] = new Payment_Controller(
850 966 Reg::getService( Interface_Logger_Service::class ),
851 - Reg::getService( 'plugin.templates_path' ),
967 + self::get_constants()->get_plugin_templates_path(),
852 968 Reg::getService( Interface_Order_Service::class )
853 969 );
854 970 }
855 971 return self::$cache[ Interface_Payment_Controller::class ];
@@ -860,15 +976,12 @@
860 976 static function () {
861 977 if ( ! isset( self::$cache[ Interface_Product_Controller::class ] ) ) {
862 978 self::$cache[ Interface_Product_Controller::class ] = new Product_Controller(
863 979 Reg::getService( Interface_Logger_Service::class ),
864 - Reg::getService( 'plugin.templates_path' ),
865 - Reg::getService( Configuration::class ),
980 + self::get_constants()->get_plugin_templates_path(),
866 981 Reg::getService( Interface_Product_Service::class ),
867 - Reg::getService( Interface_Payment_Service::class ),
868 - Reg::getService( Interface_Payment_Method_Service::class ),
869 - Reg::getService( Interface_I18n::class ),
870 - Reg::getService( Interface_Regex::class )
982 + Reg::getService( RegexProvider::class ),
983 + Reg::getService( Interface_Widgets_Service::class )
871 984 );
872 985 }
873 986 return self::$cache[ Interface_Product_Controller::class ];
874 987 }
@@ -878,9 +991,9 @@
878 991 static function () {
879 992 if ( ! isset( self::$cache[ Interface_Async_Process_Controller::class ] ) ) {
880 993 self::$cache[ Interface_Async_Process_Controller::class ] = new Async_Process_Controller(
881 994 Reg::getService( Interface_Logger_Service::class ),
882 - Reg::getService( 'plugin.templates_path' ),
995 + self::get_constants()->get_plugin_templates_path(),
883 996 Reg::getService( Interface_Report_Service::class )
884 997 );
885 998 }
886 999 return self::$cache[ Interface_Async_Process_Controller::class ];
@@ -891,9 +1004,9 @@
891 1004 static function () {
892 1005 if ( ! isset( self::$cache[ Interface_Order_Controller::class ] ) ) {
893 1006 self::$cache[ Interface_Order_Controller::class ] = new Order_Controller(
894 1007 Reg::getService( Interface_Logger_Service::class ),
895 - Reg::getService( 'plugin.templates_path' ),
1008 + self::get_constants()->get_plugin_templates_path(),
896 1009 Reg::getService( Interface_Order_Service::class )
897 1010 );
898 1011 }
899 1012 return self::$cache[ Interface_Order_Controller::class ];
@@ -903,10 +1016,11 @@
903 1016 Onboarding_REST_Controller::class,
904 1017 static function () {
905 1018 if ( ! isset( self::$cache[ Onboarding_REST_Controller::class ] ) ) {
906 1019 self::$cache[ Onboarding_REST_Controller::class ] = new Onboarding_REST_Controller(
907 - Reg::getService( 'plugin.rest_namespace' ),
908 - Reg::getService( Interface_Logger_Service::class )
1020 + self::get_constants()->get_plugin_rest_namespace(),
1021 + Reg::getService( Interface_Logger_Service::class ),
1022 + Reg::getService( RegexProvider::class )
909 1023 );
910 1024 }
911 1025 return self::$cache[ Onboarding_REST_Controller::class ];
912 1026 }
@@ -915,11 +1029,11 @@
915 1029 Payment_REST_Controller::class,
916 1030 static function () {
917 1031 if ( ! isset( self::$cache[ Payment_REST_Controller::class ] ) ) {
918 1032 self::$cache[ Payment_REST_Controller::class ] = new Payment_REST_Controller(
919 - Reg::getService( 'plugin.rest_namespace' ),
1033 + self::get_constants()->get_plugin_rest_namespace(),
920 1034 Reg::getService( Interface_Logger_Service::class ),
921 - Reg::getService( Interface_Payment_Method_Service::class )
1035 + Reg::getService( RegexProvider::class )
922 1036 );
923 1037 }
924 1038 return self::$cache[ Payment_REST_Controller::class ];
925 1039 }
@@ -928,10 +1042,12 @@
928 1042 General_Settings_REST_Controller::class,
929 1043 static function () {
930 1044 if ( ! isset( self::$cache[ General_Settings_REST_Controller::class ] ) ) {
931 1045 self::$cache[ General_Settings_REST_Controller::class ] = new General_Settings_REST_Controller(
932 - Reg::getService( 'plugin.rest_namespace' ),
933 - Reg::getService( Interface_Logger_Service::class )
1046 + self::get_constants()->get_plugin_rest_namespace(),
1047 + Reg::getService( Interface_Logger_Service::class ),
1048 + Reg::getService( RegexProvider::class ),
1049 + Reg::getService( StoreContext::class )
934 1050 );
935 1051 }
936 1052 return self::$cache[ General_Settings_REST_Controller::class ];
937 1053 }
@@ -940,27 +1056,14 @@
940 1056 Log_REST_Controller::class,
941 1057 static function () {
942 1058 if ( ! isset( self::$cache[ Log_REST_Controller::class ] ) ) {
943 1059 self::$cache[ Log_REST_Controller::class ] = new Log_REST_Controller(
944 - Reg::getService( 'plugin.rest_namespace' ),
945 - Reg::getService( Interface_Logger_Service::class )
1060 + self::get_constants()->get_plugin_rest_namespace(),
1061 + Reg::getService( Interface_Logger_Service::class ),
1062 + Reg::getService( RegexProvider::class )
946 1063 );
947 1064 }
948 1065 return self::$cache[ Log_REST_Controller::class ];
949 - }
950 - );
951 - Reg::registerService(
952 - Interface_Payment_Method_Service::class,
953 - static function () {
954 - if ( ! isset( self::$cache[ Interface_Payment_Method_Service::class ] ) ) {
955 - self::$cache[ Interface_Payment_Method_Service::class ] = new Payment_Method_Service(
956 - Reg::getService( Configuration::class ),
957 - Reg::getService( Interface_Create_Order_Request_Builder::class ),
958 - Reg::getService( Interface_Order_Service::class ),
959 - Reg::getService( Interface_Logger_Service::class )
960 - );
961 - }
962 - return self::$cache[ Interface_Payment_Method_Service::class ];
963 1066 }
964 1067 );
965 1068 }
966 1069 }