From 345d02e3101289b8b31a2ff45e52dba9c624f8e2 Mon Sep 17 00:00:00 2001 From: xl Date: Thu, 9 Nov 2023 20:31:01 +0800 Subject: [PATCH] eee --- function.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/function.php b/function.php index fd1c89fb..552351e9 100644 --- a/function.php +++ b/function.php @@ -261,6 +261,23 @@ if (!function_exists('request')) { } +if (!function_exists('inject')) { + + + /** + * @param object $object + * @return object + * @throws ReflectionException + */ + function inject(object $object): object + { + $container = Kiri::getDi(); + $reflect = $container->getReflectionClass($object::class); + $container->resolveProperties($reflect, $object); + return $object; + } +} + if (!function_exists('response')) {