Code Duplication    Length = 14-14 lines in 3 locations

src/Oro/Bundle/ContactBundle/Entity/Contact.php 2 locations

@@ 1354-1367 (lines=14) @@
1351
     *
1352
     * @return Contact
1353
     */
1354
    public function setPrimaryAddress(ContactAddress $address)
1355
    {
1356
        if ($this->hasAddress($address)) {
1357
            $address->setPrimary(true);
1358
            /** @var ContactAddress $otherAddress */
1359
            foreach ($this->getAddresses() as $otherAddress) {
1360
                if (!$address->isEqual($otherAddress)) {
1361
                    $otherAddress->setPrimary(false);
1362
                }
1363
            }
1364
        }
1365
1366
        return $this;
1367
    }
1368
1369
    /**
1370
     * Gets address type if it's available.
@@ 1377-1390 (lines=14) @@
1374
     *
1375
     * @return Contact
1376
     */
1377
    public function setAddressType(ContactAddress $address, AddressType $addressType)
1378
    {
1379
        if ($this->hasAddress($address)) {
1380
            $address->addType($addressType);
1381
            /** @var ContactAddress $otherAddress */
1382
            foreach ($this->getAddresses() as $otherAddress) {
1383
                if (!$address->isEqual($otherAddress)) {
1384
                    $otherAddress->removeType($addressType);
1385
                }
1386
            }
1387
        }
1388
1389
        return $this;
1390
    }
1391
1392
    /**
1393
     * Gets one address that has specified type.

src/Oro/Bundle/SalesBundle/Entity/Lead.php 1 location

@@ 818-831 (lines=14) @@
815
     *
816
     * @return Lead
817
     */
818
    public function setPrimaryAddress(LeadAddress $address)
819
    {
820
        if ($this->containsAddress($address)) {
821
            $address->setPrimary(true);
822
            /** @var LeadAddress $otherAddress */
823
            foreach ($this->getAddresses() as $otherAddress) {
824
                if (!$address->isEqual($otherAddress)) {
825
                    $otherAddress->setPrimary(false);
826
                }
827
            }
828
        }
829
830
        return $this;
831
    }
832
833
    /**
834
     * Get addresses