src/DataService/Batch.php
private function ProcessBatchItemResponse($oneXmlObj)
    {
        $result = new IntuitBatchResponse();
        if (null==$oneXmlObj) {
            return $result;
        }

        if(isset($oneXmlObj["bId"])){
            $bid = (String)$oneXmlObj["bId"];
            $result->batchItemId = $bid;
        }else{
            throw new \Exception("No bid Found on the Batch Response.");
        }

        $firstChild = null;
        foreach ($oneXmlObj->children() as $oneChild) {
            $firstChild = $oneChild;
            break;
        }
        if (!$firstChild) {
            return $result;
        }

        $firstChildName = (string)$firstChild->getName();

        switch ($firstChildName) {
              //For batch query result
              case "QueryResponse":
                  $result->responseType = UtilityConstants::Query;
                  $queryResult = array();
                  foreach ($oneXmlObj->QueryResponse->children() as $oneResponse) {
                      $oneEntity = $this->responseSerializer->Deserialize('<RestResponse>'.$oneResponse->asXML().'</RestResponse>');
                      $queryResult = array_merge($queryResult, $oneEntity);
                  }
                  $result->setEntities($queryResult);
                  $result->successFlagOn();
                  break;
              //For batch failure result
              case "Fault":
                  $result->responseType = UtilityConstants::Exception;
                  $idsException = $this->IterateFaultAndPrepareException($firstChild);
                  $result->exception = $idsException;
                  break;
              //For batch Entity Result
              default:
                  $result->responseType = UtilityConstants::Entity;
                  $oneEntityArray = $this->responseSerializer->Deserialize('<RestResponse>'.$firstChild->asXML().'</RestResponse>');
                  $oneEntity = $oneEntityArray[0];
                  $result->entity = $oneEntity;
                  $result->successFlagOn();
                  break;
        }

        return $result;
    }
private function ProcessBatchItemResponse($oneXmlObj)
    {
        $result = new IntuitBatchResponse();
        if (null==$oneXmlObj) {
            return $result;
        }

        if(isset($oneXmlObj["bId"])){
            $bid = (String)$oneXmlObj["bId"];
            $result->batchItemId = $bid;
        }else{
            throw new \Exception("No bid Found on the Batch Response.");
        }

        $firstChild = null;
        foreach ($oneXmlObj->children() as $oneChild) {
            $firstChild = $oneChild;
            break;
        }
        if (!$firstChild) {
            return $result;
        }

        $firstChildName = (string)$firstChild->getName();

        switch ($firstChildName) {
              //For batch query result
              case "QueryResponse":
                  $result->responseType = UtilityConstants::Query;
                  $queryResult = array();
                  foreach ($oneXmlObj->QueryResponse->children() as $oneResponse) {
                      $oneEntity = $this->responseSerializer->Deserialize('<RestResponse>'.$oneResponse->asXML().'</RestResponse>');
                      $queryResult = array_merge($queryResult, $oneEntity);
                  }
                  $result->setEntities($queryResult);
                  $result->successFlagOn();
                  break;
              //For batch failure result
              case "Fault":
                  $result->responseType = UtilityConstants::Exception;
                  $idsException = $this->IterateFaultAndPrepareException($firstChild);
                  $result->exception = $idsException;
                  break;
              //For batch Entity Result
              default:
                  $result->responseType = UtilityConstants::Entity;
                  $oneEntityArray = $this->responseSerializer->Deserialize('<RestResponse>'.$firstChild->asXML().'</RestResponse>');
                  $oneEntity = $oneEntityArray[0];
                  $result->entity = $oneEntity;
                  $result->successFlagOn();
                  break;
        }

        return $result;
    }
process batch item response
@param BatchItemResponse oneXmlObj The batchitem response.
@return IntuitBatchResponse IntuitBatchResponse object.