protected function currentStackMiddleware() : MiddlewareStorage
    {
        // add current object as first middleware middleware
        if (count($this->middleware) === 0) {
            $middleware = method_exists($this, '__invoke')
                ? $this
                : new FakeMiddlewareInvokable();
            $this->middleware[] = new MiddlewareStorage($middleware);
        }

        $middleware = end($this->middleware);
        return $middleware;
    }