Code Duplication    Length = 14-14 lines in 2 locations

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

@@ 1283-1296 (lines=14) @@
1280
     *
1281
     * @return Contact
1282
     */
1283
    public function setPrimaryAddress(ContactAddress $address)
1284
    {
1285
        if ($this->hasAddress($address)) {
1286
            $address->setPrimary(true);
1287
            /** @var ContactAddress $otherAddress */
1288
            foreach ($this->getAddresses() as $otherAddress) {
1289
                if (!$address->isEqual($otherAddress)) {
1290
                    $otherAddress->setPrimary(false);
1291
                }
1292
            }
1293
        }
1294
1295
        return $this;
1296
    }
1297
1298
    /**
1299
     * Gets address type if it's available.
@@ 1306-1319 (lines=14) @@
1303
     *
1304
     * @return Contact
1305
     */
1306
    public function setAddressType(ContactAddress $address, AddressType $addressType)
1307
    {
1308
        if ($this->hasAddress($address)) {
1309
            $address->addType($addressType);
1310
            /** @var ContactAddress $otherAddress */
1311
            foreach ($this->getAddresses() as $otherAddress) {
1312
                if (!$address->isEqual($otherAddress)) {
1313
                    $otherAddress->removeType($addressType);
1314
                }
1315
            }
1316
        }
1317
1318
        return $this;
1319
    }
1320
1321
    /**
1322
     * Gets one address that has specified type.