Code Duplication    Length = 8-8 lines in 2 locations

src/AbstractZohoDao.php 2 locations

@@ 435-442 (lines=8) @@
432
                $response = $this->zohoClient->insertRecords($this->getModule(), $xmlData, $wfTrigger, $duplicateCheck, $isApproval);
433
                $records = array_merge($records, $response->getRecords());
434
            }
435
        } else {
436
            // We can't pass more than 100 records to Zoho, so we split the request into pieces of 100
437
            foreach (array_chunk($beans, 100) as $beanPool) {
438
                $xmlData = $this->toXml($beanPool);
439
                $response = $this->zohoClient->insertRecords($this->getModule(), $xmlData, $wfTrigger, $duplicateCheck, $isApproval);
440
                $records = array_merge($records, $response->getRecords());
441
            }
442
        }
443
        if (count($records) != count($beans)) {
444
            throw new ZohoCRMException('Error while inserting beans in Zoho. '.count($beans).' passed in parameter, but '.count($records).' returned.');
445
        }
@@ 487-494 (lines=8) @@
484
                $response = $this->zohoClient->updateRecords($this->getModule(), $xmlData, $bean->getZohoId(), $wfTrigger);
485
                $records = array_merge($records, $response->getRecords());
486
            }
487
        } else {
488
            // We can't pass more than 100 records to Zoho, so we split the request into pieces of 100
489
            foreach (array_chunk($beans, 100) as $beanPool) {
490
                $xmlData = $this->toXml($beanPool);
491
                $response = $this->zohoClient->updateRecords($this->getModule(), $xmlData, null, $wfTrigger);
492
                $records = array_merge($records, $response->getRecords());
493
            }
494
        }
495
        if (count($records) != count($beans)) {
496
            throw new ZohoCRMException('Error while inserting beans in Zoho. '.count($beans).' passed in parameter, but '.count($records).' returned.');
497
        }