Code Duplication    Length = 14-14 lines in 2 locations

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

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