Code Duplication    Length = 12-14 lines in 2 locations

htdocs/lib2/logic/user.class.php 2 locations

@@ 146-157 (lines=12) @@
143
        return $this->reUser->getValue('username');
144
    }
145
146
    public function setUsername($value)
147
    {
148
        if (!mb_ereg_match(REGEX_USERNAME, $value)) {
149
            return false;
150
        }
151
152
        if (is_valid_email_address($value)) {
153
            return false;
154
        }
155
156
        return $this->reUser->setValue('username', $value);
157
    }
158
159
    public function getUsernameChanged()
160
    {
@@ 440-453 (lines=14) @@
437
        return $this->reUser->getValue('new_email');
438
    }
439
440
    public function setNewEMail($value)
441
    {
442
        if ($value !== null) {
443
            if (!is_valid_email_address($value)) {
444
                return false;
445
            }
446
447
            if (user::existEMail($value)) {
448
                return false;
449
            }
450
        }
451
452
        return $this->reUser->setValue('new_email', $value);
453
    }
454
455
    public function getWatchmailMode()
456
    {