Code Duplication    Length = 8-8 lines in 2 locations

src/AbstractZohoDao.php 2 locations

@@ 470-477 (lines=8) @@
467
                $response = $this->zohoClient->insertRecords($this->getModule(), $xmlData, $wfTrigger, $duplicateCheck, $isApproval);
468
                $records = array_merge($records, $response->getRecords());
469
            }
470
        } else {
471
            // We can't pass more than 100 records to Zoho, so we split the request into pieces of 100
472
            foreach (array_chunk($beans, 100) as $beanPool) {
473
                $xmlData = $this->toXml($beanPool);
474
                $response = $this->zohoClient->insertRecords($this->getModule(), $xmlData, $wfTrigger, $duplicateCheck, $isApproval);
475
                $records = array_merge($records, $response->getRecords());
476
            }
477
        }
478
        if (count($records) != count($beans)) {
479
            throw new ZohoCRMException('Error while inserting beans in Zoho. '.count($beans).' passed in parameter, but '.count($records).' returned.');
480
        }
@@ 524-531 (lines=8) @@
521
                $response = $this->zohoClient->updateRecords($this->getModule(), $xmlData, $bean->getZohoId(), $wfTrigger);
522
                $records = array_merge($records, $response->getRecords());
523
            }
524
        } else {
525
            // We can't pass more than 100 records to Zoho, so we split the request into pieces of 100
526
            foreach (array_chunk($beans, 100) as $beanPool) {
527
                $xmlData = $this->toXml($beanPool);
528
                $response = $this->zohoClient->updateRecords($this->getModule(), $xmlData, null, $wfTrigger);
529
                $records = array_merge($records, $response->getRecords());
530
            }
531
        }
532
        if (count($records) != count($beans)) {
533
            throw new ZohoCRMException('Error while inserting beans in Zoho. '.count($beans).' passed in parameter, but '.count($records).' returned.');
534
        }