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);
    }
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);
    }
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 ) ; }
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
Build a batch of responses to return to the user