private function returnResponse($result): Response
    {
        if ($result instanceof Response) {
            return $result;
        }

        if (is_array($result)) {
            $result = json_encode($result);
        }

        return new Response(200, [], $result);
    }
private function returnResponse($result): Response
    {
        if ($result instanceof Response) {
            return $result;
        }

        if (is_array($result)) {
            $result = json_encode($result);
        }

        return new Response(200, [], $result);
    }
private function returnResponse ( $ result ) : Response { if ( $ result instanceof Response ) { return $ result ; } if ( is_array ( $ result ) ) { $ result = json_encode ( $ result ) ; } return new Response ( 200 , [ ] , $ result ) ; }
Returns a Response object.

@param mixed $result

@return \GuzzleHttp\Psr7\Response|string
Returns a Response object .