qqq
This commit is contained in:
+6
-2
@@ -10,6 +10,7 @@ declare(strict_types=1);
|
|||||||
namespace Kiri\Di;
|
namespace Kiri\Di;
|
||||||
|
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use Kiri\Di\Interface\InjectProxyInterface;
|
use Kiri\Di\Interface\InjectProxyInterface;
|
||||||
use Kiri\Router\Interface\ValidatorInterface;
|
use Kiri\Router\Interface\ValidatorInterface;
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
@@ -53,6 +54,9 @@ class Container implements ContainerInterface
|
|||||||
private static self|null $container = null;
|
private static self|null $container = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
private function __construct()
|
private function __construct()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -74,7 +78,7 @@ class Container implements ContainerInterface
|
|||||||
* @param string $id
|
* @param string $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function get(string $id): object
|
public function get(string $id): object
|
||||||
{
|
{
|
||||||
@@ -87,7 +91,7 @@ class Container implements ContainerInterface
|
|||||||
}
|
}
|
||||||
$this->_singletons[$id] = $this->make($id);
|
$this->_singletons[$id] = $this->make($id);
|
||||||
if (!$this->_singletons[$id]) {
|
if (!$this->_singletons[$id]) {
|
||||||
throw new \Exception('Class that cannot be instantiated。');
|
throw new Exception('Class that cannot be instantiated。');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->_singletons[$id];
|
return $this->_singletons[$id];
|
||||||
|
|||||||
Reference in New Issue
Block a user