protected function transform($middleware, $wrappable = true)
    {
        if (is_a($middleware, Application::MIDDLEWARE) === false) {
            $approach = (boolean) $this->approach($middleware);

            $response = $approach === self::SINGLE_PASS ? $this->response : null;

            $wrapper = new CallableMiddlewareWrapper($middleware, $response);

            $middleware = $wrappable === true ? $wrapper : $middleware;
        }

        return $middleware;
    }