This commit is contained in:
2022-09-08 11:31:12 +08:00
parent 7b67bc1dcf
commit 8a4dcd8475
+20
View File
@@ -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