Code Duplication    Length = 7-8 lines in 2 locations

src/Users/ContactInfo.php 2 locations

@@ 230-237 (lines=8) @@
227
            return;
228
        }
229
        $this->unsetEmail();
230
        if ($this->data->email) {
231
            foreach ($this->data->email as $email) {
232
                if ($email->email_address === $email_address) {
233
                    $email->preferred = true;
234
                    return;
235
                }
236
            }
237
        }
238
        throw new Exception('Email address ' . $email_address . ' not found in user');
239
    }
240
@@ 246-252 (lines=7) @@
243
     */
244
    public function unsetEmail()
245
    {
246
        if ($this->data->email) {
247
            foreach ($this->data->email as $email) {
248
                if ($email->preferred) {
249
                    $email->preferred = false;
250
                }
251
            }
252
        }
253
    }
254
255
    /**