Code Duplication    Length = 12-13 lines in 3 locations

src/Oro/Bundle/ContactBundle/Entity/Contact.php 1 location

@@ 1292-1304 (lines=13) @@
1289
     * @param ContactPhone $phone
1290
     * @return Contact
1291
     */
1292
    public function setPrimaryPhone(ContactPhone $phone)
1293
    {
1294
        if ($this->hasPhone($phone)) {
1295
            $phone->setPrimary(true);
1296
            foreach ($this->getPhones() as $otherPhone) {
1297
                if (!$phone->isEqual($otherPhone)) {
1298
                    $otherPhone->setPrimary(false);
1299
                }
1300
            }
1301
        }
1302
1303
        return $this;
1304
    }
1305
1306
    /**
1307
     * Add address

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

@@ 687-698 (lines=12) @@
684
     *
685
     * @return B2bCustomer
686
     */
687
    public function setPrimaryPhone(B2bCustomerPhone $phone)
688
    {
689
        if ($this->hasPhone($phone)) {
690
            $phone->setPrimary(true);
691
            foreach ($this->getPhones() as $otherPhone) {
692
                if (!$phone->isEqual($otherPhone)) {
693
                    $otherPhone->setPrimary(false);
694
                }
695
            }
696
        }
697
        return $this;
698
    }
699
700
    /**
701
     * Set emails.

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

@@ 1210-1222 (lines=13) @@
1207
     *
1208
     * @return Lead
1209
     */
1210
    public function setPrimaryPhone(LeadPhone $phone)
1211
    {
1212
        if ($this->hasPhone($phone)) {
1213
            $phone->setPrimary(true);
1214
            foreach ($this->getPhones() as $otherPhone) {
1215
                if (!$phone->isEqual($otherPhone)) {
1216
                    $otherPhone->setPrimary(false);
1217
                }
1218
            }
1219
        }
1220
1221
        return $this;
1222
    }
1223
1224
    /**
1225
     * Set emails.