original_string: private function buildResponse($event, $response) {
          $success = !$response->hasErrors();
          $duplicate = ($response->code == 409);
          $statusCode = $response->code;
          $errorMessage = null;
          if ($response->code == 401) {
              $errorMessage = 'Unauthorised. Please check your Project Id and API Key';
          }
          if ($response->body != null && $response->body->errorMessage != null) {
              $errorMessage = $response->body->errorMessage;
          }
          return new Response($success, $duplicate, $statusCode, $errorMessage, $event);
      }
code: private function buildResponse($event, $response) {
          $success = !$response->hasErrors();
          $duplicate = ($response->code == 409);
          $statusCode = $response->code;
          $errorMessage = null;
          if ($response->code == 401) {
              $errorMessage = 'Unauthorised. Please check your Project Id and API Key';
          }
          if ($response->body != null && $response->body->errorMessage != null) {
              $errorMessage = $response->body->errorMessage;
          }
          return new Response($success, $duplicate, $statusCode, $errorMessage, $event);
      }
code_tokens: private function buildResponse ( $ event , $ response ) { $ success = ! $ response -> hasErrors ( ) ; $ duplicate = ( $ response -> code == 409 ) ; $ statusCode = $ response -> code ; $ errorMessage = null ; if ( $ response -> code == 401 ) { $ errorMessage = 'Unauthorised. Please check your Project Id and API Key' ; } if ( $ response -> body != null && $ response -> body -> errorMessage != null ) { $ errorMessage = $ response -> body -> errorMessage ; } return new Response ( $ success , $ duplicate , $ statusCode , $ errorMessage , $ event ) ; }
docstring: Build a single response to return to the user
  @param array $event the event that the response is related to
  @param \Httpful\Response $response The response from the API
  @return Response
docstring_tokens: Build a single response to return to the user