original_string: private function buildBatchResponse($batch, $response) {
          $result = [];
          $responseBody = json_decode($response->raw_body, true);
          foreach ($batch as $collection => $events) {
              $eventResults = [];
              $eventResponses = $responseBody[$collection];
              foreach($events as $index => $event) {
                  $eventResponse = $eventResponses[$index];
                  $eventResult = new Response($eventResponse['success'], $eventResponse['duplicate'], null, $eventResponse['message'], $event);
                  array_push($eventResults, $eventResult);
              }
              $result[$collection] = $eventResults;
          }
  
          $statusCode = $response->code;
          $errorMessage = $response->body->errorMessage;
  
          return new ResponseBatch($statusCode, $errorMessage, $result);
      }
code: private function buildBatchResponse($batch, $response) {
          $result = [];
          $responseBody = json_decode($response->raw_body, true);
          foreach ($batch as $collection => $events) {
              $eventResults = [];
              $eventResponses = $responseBody[$collection];
              foreach($events as $index => $event) {
                  $eventResponse = $eventResponses[$index];
                  $eventResult = new Response($eventResponse['success'], $eventResponse['duplicate'], null, $eventResponse['message'], $event);
                  array_push($eventResults, $eventResult);
              }
              $result[$collection] = $eventResults;
          }
  
          $statusCode = $response->code;
          $errorMessage = $response->body->errorMessage;
  
          return new ResponseBatch($statusCode, $errorMessage, $result);
      }
code_tokens: private function buildBatchResponse ( $ batch , $ response ) { $ result = [ ] ; $ responseBody = json_decode ( $ response -> raw_body , true ) ; foreach ( $ batch as $ collection => $ events ) { $ eventResults = [ ] ; $ eventResponses = $ responseBody [ $ collection ] ; foreach ( $ events as $ index => $ event ) { $ eventResponse = $ eventResponses [ $ index ] ; $ eventResult = new Response ( $ eventResponse [ 'success' ] , $ eventResponse [ 'duplicate' ] , null , $ eventResponse [ 'message' ] , $ event ) ; array_push ( $ eventResults , $ eventResult ) ; } $ result [ $ collection ] = $ eventResults ; } $ statusCode = $ response -> code ; $ errorMessage = $ response -> body -> errorMessage ; return new ResponseBatch ( $ statusCode , $ errorMessage , $ result ) ; }
docstring: Build a batch of responses to return to the user
  @param array $batch the batch that the response is related to
  @param \Httpful\Response $response The response from the API
  @return Response
docstring_tokens: Build a batch of responses to return to the user