Code Duplication    Length = 24-27 lines in 2 locations

class.AuthProvider.php 2 locations

@@ 463-486 (lines=24) @@
460
     *
461
     * @return boolean true if the user was successfully created. Otherwise false.
462
     */
463
    public function activatePendingUser($user, $methodName = false)
464
    {
465
        if($methodName === false)
466
        {
467
            $count = count($this->methods);
468
            for($i = 0; $i < $count; $i++)
469
            {
470
                if($this->methods[$i]->current === false)
471
                {
472
                    continue;
473
                }
474
475
                $ret = $this->methods[$i]->activatePendingUser($user);
476
                if($ret !== false)
477
                {
478
                    $this->impersonateUser($ret);
479
                    return true;
480
                }
481
            }
482
            return false;
483
        }
484
        $auth = $this->getMethodByName($methodName);
485
        return $auth->activatePendingUser($user);
486
    }
487
488
    /**
489
     * Get a current user by a password reset hash
@@ 496-522 (lines=27) @@
493
     *
494
     * @return Auth\User|false The user if the password reset hash is valid. Otherwise false.
495
     */
496
    public function getUserByResetHash($hash, $methodName = false)
497
    {
498
        if($methodName === false)
499
        {
500
            $count = count($this->methods);
501
            for($i = 0; $i < $count; $i++)
502
            {
503
                if($this->methods[$i]->current === false)
504
                {
505
                    continue;
506
                }
507
508
                $ret = $this->methods[$i]->getUserByResetHash($hash);
509
                if($ret !== false)
510
                {
511
                    return $ret;
512
                }
513
            }
514
            return false;
515
        }
516
        $auth = $this->getMethodByName($methodName);
517
        if($auth === false)
518
        {
519
            return $this->getUserByResetHash($hash, false);
520
        }
521
        return $auth->getUserByResetHash($hash);
522
    }
523
524
    /**
525
     * Get the Auth\Authenticator by host name