Code Duplication    Length = 12-12 lines in 3 locations

src/Http/Api/UserController.php 3 locations

@@ 503-514 (lines=12) @@
500
        }
501
502
        $user = Sentinel::findByCredentials([ 'email' => $email ]);
503
        if (!$user)
504
        {
505
            throw new \UnexpectedValueException('the user is not exists.', -10010);
506
        }
507
        else if ($user->invalid_flag === 1)
508
        {
509
            throw new \UnexpectedValueException('the user has been disabled.', -10011);
510
        }
511
        else if ($user->directory && $user->directory != 'self')
512
        {
513
            throw new \UnexpectedValueException('the user is external sync user.', -10012);
514
        }
515
516
        if ($email === '[email protected]')
517
        {
@@ 631-642 (lines=12) @@
628
629
        $email = $reset_code->email;
630
        $user = Sentinel::findByCredentials([ 'email' => $email ]);
631
        if (!$user)
632
        {
633
            throw new \UnexpectedValueException('the user is not exists.', -10010);
634
        }
635
        else if ($user->invalid_flag === 1)
636
        {
637
            throw new \UnexpectedValueException('the user has been disabled.', -10011);
638
        }
639
        else if ($user->directory && $user->directory != 'self')
640
        {
641
            throw new \UnexpectedValueException('the user is external sync user.', -10012);
642
        }
643
644
        return Response()->json([ 'ecode' => 0, 'data' => [ 'email' => $reset_code['email'] ] ]);
645
    }
@@ 684-695 (lines=12) @@
681
682
        $email = $reset_code->email;
683
        $user = Sentinel::findByCredentials([ 'email' => $email ]);
684
        if (!$user)
685
        {
686
            throw new \UnexpectedValueException('the user is not exsits.', -10010);
687
        }
688
        else if ($user->invalid_flag === 1)
689
        {
690
            throw new \UnexpectedValueException('the user has been disabled.', -10011);
691
        }
692
        else if ($user->directory && $user->directory != 'self')
693
        {
694
            throw new \UnexpectedValueException('the user is external sync user.', -10012);
695
        }
696
697
        $valid = Sentinel::validForUpdate($user, [ 'password' => $password ]);
698
        if (!$valid)