src/Container/Container.php
public function resolve($id, ServerRequestInterface $request = null)
    {
        $reflection = new \ReflectionClass($id);

        if ($constructor = $reflection->getConstructor()) {
            $arguments = array();

            foreach ($constructor->getParameters() as $parameter) {
                $argument = $this->argument($parameter);

                $arguments[] = $this->request($argument, $request);
            }

            return $reflection->newInstanceArgs($arguments);
        }

        return $this->extra->get($id);
    }
public function resolve($id, ServerRequestInterface $request = null)
    {
        $reflection = new \ReflectionClass($id);

        if ($constructor = $reflection->getConstructor()) {
            $arguments = array();

            foreach ($constructor->getParameters() as $parameter) {
                $argument = $this->argument($parameter);

                $arguments[] = $this->request($argument, $request);
            }

            return $reflection->newInstanceArgs($arguments);
        }

        return $this->extra->get($id);
    }
Resolves the specified identifier to an instance.

@throws \Psr\Container\NotFoundExceptionInterface

@param  string                                        $id
@param  \Psr\Http\Message\ServerRequestInterface|null $request
@return mixed