Compare commits

...

1 Commits

Author SHA1 Message Date
as2252258 f46af653f2 1 2022-01-09 14:33:33 +08:00
3 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -8,7 +8,7 @@ use JetBrains\PhpStorm\Pure;
use Kiri\Abstracts\Config; use Kiri\Abstracts\Config;
use Kiri\Application; use Kiri\Application;
use Kiri\Core\ArrayAccess; use Kiri\Core\ArrayAccess;
use Kiri\Di\AnnotationManager; use Kiri\Di\NoteManager;
use Kiri\Error\Logger; use Kiri\Error\Logger;
use Kiri\Events\EventDispatch; use Kiri\Events\EventDispatch;
use Kiri\Events\EventProvider; use Kiri\Events\EventProvider;
@@ -261,7 +261,7 @@ if (!function_exists('injectRuntime')) {
$router = []; $router = [];
foreach ($fileLists as $class) { foreach ($fileLists as $class) {
foreach (AnnotationManager::getTargetAnnotation($class) as $value) { foreach (NoteManager::getTargetAnnotation($class) as $value) {
if (!method_exists($value, 'execute')) { if (!method_exists($value, 'execute')) {
continue; continue;
} }
+5 -5
View File
@@ -197,7 +197,7 @@ class Container implements ContainerInterface
*/ */
public function propertyInject(ReflectionClass $reflect, $object): mixed public function propertyInject(ReflectionClass $reflect, $object): mixed
{ {
foreach (AnnotationManager::getPropertyAnnotation($reflect) as $property => $inject) { foreach (NoteManager::getPropertyAnnotation($reflect) as $property => $inject) {
/** @var Inject $inject */ /** @var Inject $inject */
$inject->execute($object, $property); $inject->execute($object, $property);
} }
@@ -212,7 +212,7 @@ class Container implements ContainerInterface
*/ */
public function getMethodAttribute($className, $method = null): array public function getMethodAttribute($className, $method = null): array
{ {
$methods = AnnotationManager::getMethodAnnotation($this->getReflect($className)); $methods = NoteManager::getMethodAnnotation($this->getReflect($className));
if (!empty($method)) { if (!empty($method)) {
return $methods[$method] ?? []; return $methods[$method] ?? [];
} }
@@ -227,7 +227,7 @@ class Container implements ContainerInterface
*/ */
public function getClassReflectionProperty(string $class, string $property = null): ReflectionProperty|null|array public function getClassReflectionProperty(string $class, string $property = null): ReflectionProperty|null|array
{ {
$lists = AnnotationManager::getProperty($this->getReflect($class)); $lists = NoteManager::getProperty($this->getReflect($class));
if (empty($lists)) { if (empty($lists)) {
return null; return null;
} }
@@ -266,7 +266,7 @@ class Container implements ContainerInterface
if ($reflect->isAbstract() || $reflect->isTrait() || $reflect->isInterface()) { if ($reflect->isAbstract() || $reflect->isTrait() || $reflect->isInterface()) {
return $this->_reflection[$class] = $reflect; return $this->_reflection[$class] = $reflect;
} }
$construct = AnnotationManager::resolveTarget($reflect); $construct = NoteManager::resolveTarget($reflect);
if (!empty($construct) && $construct->getNumberOfParameters() > 0) { if (!empty($construct) && $construct->getNumberOfParameters() > 0) {
$this->_constructs[$class] = $construct; $this->_constructs[$class] = $construct;
} }
@@ -284,7 +284,7 @@ class Container implements ContainerInterface
if (is_string($class)) { if (is_string($class)) {
$class = $this->getReflect($class); $class = $this->getReflect($class);
} }
return AnnotationManager::getMethods($class); return NoteManager::getMethods($class);
} }
+4 -4
View File
@@ -7,7 +7,7 @@ use ReflectionAttribute;
use ReflectionClass; use ReflectionClass;
use ReflectionProperty; use ReflectionProperty;
class AnnotationManager class NoteManager
{ {
@@ -171,9 +171,9 @@ class AnnotationManager
*/ */
public static function resolveTarget(ReflectionClass $reflect): ?\ReflectionMethod public static function resolveTarget(ReflectionClass $reflect): ?\ReflectionMethod
{ {
AnnotationManager::setPropertyAnnotation($reflect); NoteManager::setPropertyAnnotation($reflect);
AnnotationManager::setTargetAnnotation($reflect); NoteManager::setTargetAnnotation($reflect);
AnnotationManager::setMethodAnnotation($reflect); NoteManager::setMethodAnnotation($reflect);
return $reflect->getConstructor(); return $reflect->getConstructor();
} }