变更
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user