From efd8ad2f7172327375103e05a22cd6d4220c5886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Sun, 16 Apr 2023 01:45:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ContainerInterface.php | 1 + Context.php | 1 + Context/AsyncContext.php | 3 + Context/ContextInterface.php | 1 + Context/CoroutineContext.php | 1 + Inject/Config.php | 1 + Inject/Container.php | 1 + Inject/ContainerParams.php | 1 + Inject/Service.php | 1 + Inject/ServiceParams.php | 1 + Interface/InjectParameterInterface.php | 1 + Interface/InjectPropertyInterface.php | 1 + Interface/ResponseEmitter.php | 1 + LocalService.php | 1 + Target.php | 142 ------------------------- TargetManager.php | 46 -------- 16 files changed, 16 insertions(+), 188 deletions(-) delete mode 100644 Target.php delete mode 100644 TargetManager.php diff --git a/ContainerInterface.php b/ContainerInterface.php index 1d62db1..876d95b 100644 --- a/ContainerInterface.php +++ b/ContainerInterface.php @@ -1,4 +1,5 @@ target = $target; - $this->construct = $target->getConstructor(); - } - - - /** - * @return mixed|ReflectionMethod|null - */ - public function getConstruct(): mixed - { - return $this->construct; - } - - - /** - * @return ReflectionAttribute[] - */ - #[Pure] public function getAttributes(): array - { - return $this->target->getAttributes(); - } - - - /** - * @param string $property - * @return ReflectionProperty - * @throws ReflectionException - */ - #[Pure] public function getProperty(string $property): ReflectionProperty - { - return $this->target->getProperty($property); - } - - - /** - * @return array - */ - #[Pure] public function getMethods(): array - { - return $this->target->getMethods(); - } - - - /** - * @param string $method - * @return ReflectionMethod - * @throws ReflectionException - */ - #[Pure] public function getMethod(string $method): ReflectionMethod - { - return $this->target->getMethod($method); - } - - - /** - * @param string $method - * @param string $annotation - * @return null|array - * @throws ReflectionException - */ - #[Pure] public function searchNote(string $method, string $annotation): ?array - { - $data = $this->getMethodAttribute($method, $annotation); - if (!empty($data)) { - return $data; - } - return null; - } - - - /** - * @return array - * @throws ReflectionException - */ - #[Pure] public function getMethodsAttribute(): array - { - $methods = $this->target->getMethods(); - - $array = []; - foreach ($methods as $method) { - $array[$method->getName()] = $this->getMethodAttribute($method->getName()); - } - return $array; - } - - - /** - * @return ReflectionProperty[] - */ - #[Pure] public function getPropertyAttribute(): array - { - return $this->target->getProperties(ReflectionProperty::IS_PRIVATE | ReflectionProperty::IS_PROTECTED | ReflectionProperty::IS_PUBLIC); - } - - - /** - * @param string $property - * @param string|null $annotation - * @return array|ReflectionAttribute - * @throws ReflectionException - */ - #[Pure] public function getMethodAttribute(string $property, ?string $annotation = null): array|ReflectionAttribute - { - $attributes = $this->target->getMethod($property); - if (!empty($annotation)) { - return $attributes->getAttributes($annotation); - } - return $attributes->getAttributes(); - } -} diff --git a/TargetManager.php b/TargetManager.php deleted file mode 100644 index cfc9674..0000000 --- a/TargetManager.php +++ /dev/null @@ -1,46 +0,0 @@ -