private function preparePrototypeBindingClosure($id, $blueprint, $dependencies): Closure
    {
        if ($blueprint instanceof ReflectionClass) {
            return $this->cache[$id] = function () use ($blueprint, $dependencies) {
                foreach ($dependencies as $key => $dependency) {
                    if ($dependency instanceof Closure) {
                        $dependencies[$key] = $dependency();
                    }
                }

                return $blueprint->newInstanceArgs($dependencies);
            };
        }
        if ($blueprint instanceof Closure) {
            return $this->cache[$id] = $blueprint;
        }

        return $this->cache[$id] = function () use ($blueprint) {
            return new $blueprint;
        };
    }