private function validateJsonResponse($responseBody)
    {
        $data = json_decode($responseBody);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new \Exception('Error decoding JSON.');
        }

        if (isset($data->error)) {
            throw new \Exception($data->error->error_message);
        }

        if (empty($data)) {
            throw new \Exception('No results found.');
        }

        return $responseBody;
    }
private function validateJsonResponse($responseBody)
    {
        $data = json_decode($responseBody);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new \Exception('Error decoding JSON.');
        }

        if (isset($data->error)) {
            throw new \Exception($data->error->error_message);
        }

        if (empty($data)) {
            throw new \Exception('No results found.');
        }

        return $responseBody;
    }
private function validateJsonResponse ( $ responseBody ) { $ data = json_decode ( $ responseBody ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { throw new \ Exception ( 'Error decoding JSON.' ) ; } if ( isset ( $ data -> error ) ) { throw new \ Exception ( $ data -> error -> error_message ) ; } if ( empty ( $ data ) ) { throw new \ Exception ( 'No results found.' ) ; } return $ responseBody ; }
Parses the response content for the JSON output format

@param string $responseBody

@return string
@throws \Exception
Parses the response content for the JSON output format