From b6c422c96ee238770e94bfb346a516875028b11d Mon Sep 17 00:00:00 2001 From: Peter Pajor Date: Mon, 16 Jan 2023 12:15:46 +0100 Subject: [PATCH] Add service registry to access container directly. --- src/ServiceRegistry.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/ServiceRegistry.php diff --git a/src/ServiceRegistry.php b/src/ServiceRegistry.php new file mode 100644 index 0000000..6866a6d --- /dev/null +++ b/src/ServiceRegistry.php @@ -0,0 +1,28 @@ +get($name); + } + + /** + * Returns the service container. + */ + protected static function getContainer(): ContainerBuilder { + if (self::$container === NULL) { + self::$container = require realpath(__DIR__ . '/../includes/container.php'); + } + return self::$container; + } + +}