| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
require_once __DIR__ . '/bootstrap/CoreServiceRegistration.php'; |
| 8 |
require_once __DIR__ . '/bootstrap/DataServiceRegistration.php'; |
| 9 |
require_once __DIR__ . '/bootstrap/DomainServiceRegistration.php'; |
| 10 |
require_once __DIR__ . '/bootstrap/MatchingEngineServiceRegistration.php'; |
| 11 |
require_once __DIR__ . '/bootstrap/Abj404ServiceRegistrationContract.php'; |
| 12 |
require_once __DIR__ . '/bootstrap/RuntimeServiceRegistration.php'; |
| 13 |
require_once __DIR__ . '/bootstrap/LegacyInstanceResolver.php'; |
| 14 |
require_once __DIR__ . '/bootstrap/service-locator.php'; |
| 15 |
|
| 16 |
/** |
| 17 |
* Bootstrap file for initializing the service container and registering services. |
| 18 |
* |
| 19 |
* This file keeps the entry points stable while layer-specific registration |
| 20 |
* modules own the actual factory wiring. |
| 21 |
*/ |
| 22 |
|
| 23 |
/** |
| 24 |
* Initialize all services in the dependency injection container. |
| 25 |
* |
| 26 |
* Services are registered with factory functions that define their dependencies. |
| 27 |
* The container handles lazy instantiation and ensures each service is a singleton. |
| 28 |
* |
| 29 |
* @return void |
| 30 |
*/ |
| 31 |
function abj_404_solution_init_services() { |
| 32 |
$container = ABJ_404_Solution_ServiceContainer::getInstance(); |
| 33 |
|
| 34 |
ABJ_404_Solution_CoreServiceRegistration::register($container); |
| 35 |
ABJ_404_Solution_DataServiceRegistration::register($container); |
| 36 |
ABJ_404_Solution_DomainServiceRegistration::register($container); |
| 37 |
ABJ_404_Solution_MatchingEngineServiceRegistration::register($container); |
| 38 |
ABJ_404_Solution_RuntimeServiceRegistration::register($container); |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Backward compatibility function for accessing services. |
| 43 |
* |
| 44 |
* This allows existing code to continue working while we migrate |
| 45 |
* to the container pattern. Eventually this can be removed. |
| 46 |
* |
| 47 |
* @param string $className The class name to get an instance of |
| 48 |
* @return mixed The service instance |
| 49 |
*/ |
| 50 |
function abj_get_instance($className) { |
| 51 |
return ABJ_404_Solution_LegacyInstanceResolver::resolve($className); |
| 52 |
} |
| 53 |
|