Code Duplication    Length = 12-13 lines in 3 locations

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

@@ 1315-1327 (lines=13) @@
1312
     * @param ContactPhone $phone
1313
     * @return Contact
1314
     */
1315
    public function setPrimaryPhone(ContactPhone $phone)
1316
    {
1317
        if ($this->hasPhone($phone)) {
1318
            $phone->setPrimary(true);
1319
            foreach ($this->getPhones() as $otherPhone) {
1320
                if (!$phone->isEqual($otherPhone)) {
1321
                    $otherPhone->setPrimary(false);
1322
                }
1323
            }
1324
        }
1325
1326
        return $this;
1327
    }
1328
1329
    /**
1330
     * Add address

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

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

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

@@ 1230-1242 (lines=13) @@
1227
     *
1228
     * @return Lead
1229
     */
1230
    public function setPrimaryPhone(LeadPhone $phone)
1231
    {
1232
        if ($this->hasPhone($phone)) {
1233
            $phone->setPrimary(true);
1234
            foreach ($this->getPhones() as $otherPhone) {
1235
                if (!$phone->isEqual($otherPhone)) {
1236
                    $otherPhone->setPrimary(false);
1237
                }
1238
            }
1239
        }
1240
1241
        return $this;
1242
    }
1243
1244
    /**
1245
     * Set emails.