diff --git a/Container.php b/Container.php index 641b47f..fdffa5a 100644 --- a/Container.php +++ b/Container.php @@ -56,6 +56,14 @@ class Container implements ContainerInterface private array $_interfaces = []; + private static ?ContainerInterface $container = null; + + + private function __construct() + { + } + + /** * @param string $id * @return mixed @@ -70,6 +78,18 @@ class Container implements ContainerInterface } + /** + * @return static + */ + public static function getInstance(): static + { + if (static::$container == null) { + static::$container = new static(); + } + return static::$container; + } + + /** * @param $class * @param array $constrict