From 49b3085ab14cba65667a548671b0c518d6b27ab0 Mon Sep 17 00:00:00 2001 From: whwyy Date: Thu, 30 Nov 2023 18:03:48 +0800 Subject: [PATCH] eee --- kiri-engine/Application.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/kiri-engine/Application.php b/kiri-engine/Application.php index dd8ed4f0..73f16305 100644 --- a/kiri-engine/Application.php +++ b/kiri-engine/Application.php @@ -87,20 +87,23 @@ class Application extends BaseApplication /** - * @param string $service + * @param string ...$services * @return $this - * @throws + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface */ - public function import(string $service): static + public function import(string ...$services): static { - if (!class_exists($service)) { - return $this; - } + foreach ($services as $service) { + if (!class_exists($service)) { + continue; + } - /** @var Kiri\Abstracts\Provider $class */ - $class = $this->container->get($service); - if (method_exists($class, 'onImport')) { - $class->onImport(); + /** @var Kiri\Abstracts\Provider $class */ + $class = $this->container->get($service); + if (method_exists($class, 'onImport')) { + $class->onImport(); + } } return $this; }