PluginProbe
404 Solution / 4.3.0
404 Solution v4.3.0
4.3.5 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.2.0 4.1.19 4.1.18 4.1.17 4.1.16 4.1.15 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.1.7 4.1.6 4.1.5 4.1.4 4.1.3 trunk 2.30.0 All 109 releases
404-solution / includes / bootstrap / CoreServiceRegistration.php

CoreServiceRegistration.php in 404 Solution 4.3.0, at includes/bootstrap/CoreServiceRegistration.php

83 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) {
4 exit;
5 }
6
7 /**
8 * Registers low-level infrastructure services used by all later bootstrap layers.
9 */
10 class ABJ_404_Solution_CoreServiceRegistration {
11
12 /**
13 * @param ABJ_404_Solution_ServiceContainer $container
14 * @return void
15 */
16 public static function register($container): void {
17 $container->set('mb_string_adapter', function($c) {
18 if (extension_loaded('mbstring')) {
19 return ABJ_404_Solution_MbStringAdapterMb::getInstance();
20 }
21 return ABJ_404_Solution_MbStringAdapterPreg::getInstance();
22 });
23
24 $container->set('regex_helper', function($c) {
25 if (extension_loaded('mbstring')) {
26 return ABJ_404_Solution_RegexHelperMb::getInstance();
27 }
28 return ABJ_404_Solution_RegexHelperPreg::getInstance();
29 });
30
31 $container->set('functions', function($c) {
32 return new ABJ_404_Solution_Functions(
33 $c->get('logging'),
34 $c->get('request_context'),
35 $c->get('mb_string_adapter'),
36 $c->get('regex_helper')
37 );
38 });
39
40 $container->set('pii_redactor', function($c) {
41 return new ABJ_404_Solution_PiiRedactor($c->get('functions'));
42 });
43
44 $container->set('url_encoder', function($c) {
45 return new ABJ_404_Solution_UrlEncoder($c->get('mb_string_adapter'), $c->get('regex_helper'));
46 });
47
48 $container->set('sanitizer', function($c) {
49 return new ABJ_404_Solution_Sanitizer($c->get('mb_string_adapter'));
50 });
51
52 $container->set('query_string_helper', function($c) {
53 return new ABJ_404_Solution_QueryStringHelper($c->get('sanitizer'), $c->get('logging'));
54 });
55
56 $container->set('logging', function($c) {
57 return ABJ_404_Solution_Logging::createForContainer();
58 });
59
60 $container->set('clock', function($c) {
61 return new ABJ_404_Solution_SystemClock();
62 });
63
64 $container->set('cron_scheduler', function($c) {
65 return new ABJ_404_Solution_CronScheduler(
66 $c->get('clock'),
67 $c->get('logging')
68 );
69 });
70
71 $container->set('rebuild_health', function($c) {
72 return new ABJ_404_Solution_RebuildHealthState(
73 $c->get('clock'),
74 $c->get('logging')
75 );
76 });
77
78 $container->set('error_handler', function($c) {
79 return 'ABJ_404_Solution_ErrorHandler';
80 });
81 }
82 }
83