Code Duplication    Length = 12-13 lines in 2 locations

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

@@ 1201-1213 (lines=13) @@
1198
     * @param ContactEmail $email
1199
     * @return Contact
1200
     */
1201
    public function setPrimaryEmail(ContactEmail $email)
1202
    {
1203
        if ($this->hasEmail($email)) {
1204
            $email->setPrimary(true);
1205
            foreach ($this->getEmails() as $otherEmail) {
1206
                if (!$email->isEqual($otherEmail)) {
1207
                    $otherEmail->setPrimary(false);
1208
                }
1209
            }
1210
        }
1211
1212
        return $this;
1213
    }
1214
1215
    /**
1216
     * Set phones.

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

@@ 787-798 (lines=12) @@
784
     *
785
     * @return B2bCustomer
786
     */
787
    public function setPrimaryEmail(B2bCustomerEmail $email)
788
    {
789
        if ($this->hasEmail($email)) {
790
            $email->setPrimary(true);
791
            foreach ($this->getEmails() as $otherEmail) {
792
                if (!$email->isEqual($otherEmail)) {
793
                    $otherEmail->setPrimary(false);
794
                }
795
            }
796
        }
797
        return $this;
798
    }
799
}
800