Code Duplication    Length = 12-13 lines in 2 locations

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

@@ 1178-1190 (lines=13) @@
1175
     * @param ContactEmail $email
1176
     * @return Contact
1177
     */
1178
    public function setPrimaryEmail(ContactEmail $email)
1179
    {
1180
        if ($this->hasEmail($email)) {
1181
            $email->setPrimary(true);
1182
            foreach ($this->getEmails() as $otherEmail) {
1183
                if (!$email->isEqual($otherEmail)) {
1184
                    $otherEmail->setPrimary(false);
1185
                }
1186
            }
1187
        }
1188
1189
        return $this;
1190
    }
1191
1192
    /**
1193
     * Set phones.

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

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