Code Duplication    Length = 10-10 lines in 3 locations

code/api/CampaignMonitorAPIConnector.php 3 locations

@@ 1338-1347 (lines=10) @@
1335
    ) {
1336
        //require_once '../../csrest_subscribers.php';
1337
        $wrap = new CS_REST_Subscribers($listID, $this->getAuth());
1338
        foreach ($customFields as $key => $customFieldValue) {
1339
            if (!is_array($customFields[$key])) {
1340
                $customFields[] = array(
1341
                    "Key" => $key,
1342
                    "Value" => $customFieldValue,
1343
                    "Clear" => $customFieldValue ? false : true
1344
                );
1345
                unset($customFields[$key]);
1346
            }
1347
        }
1348
        $result = $wrap->add(
1349
            $request = array(
1350
                'EmailAddress' => $member->Email,
@@ 1396-1405 (lines=10) @@
1393
        if (!$oldEmailAddress) {
1394
            $oldEmailAddress = $member->Email;
1395
        }
1396
        foreach ($customFields as $key => $customFieldValue) {
1397
            if (!is_array($customFields[$key])) {
1398
                $customFields[] = array(
1399
                    "Key" => $key,
1400
                    "Value" => $customFieldValue,
1401
                    "Clear" => $customFieldValue ? false : true
1402
                );
1403
                unset($customFields[$key]);
1404
            }
1405
        }
1406
        //require_once '../../csrest_subscribers.php';
1407
        $wrap = new CS_REST_Subscribers($listID, $this->getAuth());
1408
        $result = $wrap->update(
@@ 1464-1473 (lines=10) @@
1461
            } elseif (isset($customFields[$member->Email])) {
1462
                $customFieldsForMember = $customFields[$member->Email];
1463
            }
1464
            foreach ($customFieldsForMember as $key => $customFieldValue) {
1465
                if (!is_array($customFieldsForMember[$key])) {
1466
                    $customFieldsForMember[] = array(
1467
                        "Key" => $key,
1468
                        "Value" => $customFieldValue,
1469
                        "Clear" => $customFieldValue ? false : true
1470
                    );
1471
                    unset($customFieldsForMember[$key]);
1472
                }
1473
            }
1474
            if ($member instanceof Member) {
1475
                $importArray[] = array(
1476
                    'EmailAddress' => $member->Email,