Code Duplication    Length = 8-8 lines in 2 locations

src/AbstractZohoDao.php 2 locations

@@ 462-469 (lines=8) @@
459
                $response = $this->zohoClient->insertRecords($this->getModule(), $xmlData, $wfTrigger, $duplicateCheck, $isApproval);
460
                $records = array_merge($records, $response->getRecords());
461
            }
462
        } else {
463
            // We can't pass more than 100 records to Zoho, so we split the request into pieces of 100
464
            foreach (array_chunk($beans, 100) as $beanPool) {
465
                $xmlData = $this->toXml($beanPool);
466
                $response = $this->zohoClient->insertRecords($this->getModule(), $xmlData, $wfTrigger, $duplicateCheck, $isApproval);
467
                $records = array_merge($records, $response->getRecords());
468
            }
469
        }
470
        if (count($records) != count($beans)) {
471
            throw new ZohoCRMException('Error while inserting beans in Zoho. '.count($beans).' passed in parameter, but '.count($records).' returned.');
472
        }
@@ 514-521 (lines=8) @@
511
                $response = $this->zohoClient->updateRecords($this->getModule(), $xmlData, $bean->getZohoId(), $wfTrigger);
512
                $records = array_merge($records, $response->getRecords());
513
            }
514
        } else {
515
            // We can't pass more than 100 records to Zoho, so we split the request into pieces of 100
516
            foreach (array_chunk($beans, 100) as $beanPool) {
517
                $xmlData = $this->toXml($beanPool);
518
                $response = $this->zohoClient->updateRecords($this->getModule(), $xmlData, null, $wfTrigger);
519
                $records = array_merge($records, $response->getRecords());
520
            }
521
        }
522
        if (count($records) != count($beans)) {
523
            throw new ZohoCRMException('Error while inserting beans in Zoho. '.count($beans).' passed in parameter, but '.count($records).' returned.');
524
        }