Code Duplication    Length = 6-6 lines in 2 locations

src/Routing/Dispatcher/ControllerDispatcher.php 1 location

@@ 45-50 (lines=6) @@
42
    {
43
        $reflectionMethod = new ReflectionMethod($this->route->getTarget('controller'), $this->route->getTarget('action'));
44
        $dependencies = ($this->route->getParameters() == '') ? [] : $this->route->getParameters();
45
        foreach ($reflectionMethod->getParameters() as $arg) {
46
            if (!is_null($arg->getClass())) {
47
                $class = $arg->getClass()->name;
48
                array_unshift($dependencies, call_user_func_array($this->route->getTarget('di'),[$class]));
49
            }
50
        }
51
        if ($this->response->getStatusCode() == 202)
52
            $this->response->setStatusCode(200);
53
        return $this->response->setContent($reflectionMethod->invokeArgs($this->getController(), $dependencies));

src/Routing/Middleware.php 1 location

@@ 89-94 (lines=6) @@
86
    private function callHandler($instance){
87
        $reflectionMethod = new ReflectionMethod($instance, 'handle');
88
        $dependencies = [$this->router->route];
89
        foreach ($reflectionMethod->getParameters() as $arg) {
90
            if (!is_null($arg->getClass())) {
91
                $class = $arg->getClass()->name;
92
                array_unshift($dependencies,call_user_func_array($this->router->getConfig()['di'],[$class]));
93
            }
94
        }
95
        return $reflectionMethod->invokeArgs($instance, $dependencies);
96
    }
97