This commit is contained in:
xl
2024-08-29 17:01:08 +08:00
parent 337c52c744
commit c435af1156
15 changed files with 61 additions and 167 deletions
+2 -10
View File
@@ -20,14 +20,6 @@ class ControllerInterpreter
{
/**
* @param ContainerInterface $container
*/
public function __construct(public ContainerInterface $container)
{
}
/**
* @param object $class
* @param string|ReflectionMethod $method
@@ -38,7 +30,7 @@ class ControllerInterpreter
public function addRouteByString(object $class, string|ReflectionMethod $method, ?ReflectionClass $reflection = null): Handler
{
if (is_null($reflection)) {
$reflection = $this->container->getReflectionClass($class::class);
$reflection = Kiri::getDi()->getReflectionClass($class::class);
}
return $this->resolveMethod($class, $method, $reflection);
}
@@ -71,7 +63,7 @@ class ControllerInterpreter
public function addRouteByObject(object $class, string|ReflectionMethod $method, ?ReflectionClass $reflection = null): Handler
{
if (is_null($reflection)) {
$reflection = $this->container->getReflectionClass($class::class);
$reflection = Kiri::getDi()->getReflectionClass($class::class);
}
return $this->resolveMethod($class, $method, $reflection);
}