Code Duplication    Length = 24-27 lines in 2 locations

class.AuthProvider.php 2 locations

@@ 443-466 (lines=24) @@
440
     *
441
     * @return boolean true if the user was successfully created. Otherwise false.
442
     */
443
    public function activatePendingUser($user, $methodName = false)
444
    {
445
        if($methodName === false)
446
        {
447
            $count = count($this->methods);
448
            for($i = 0; $i < $count; $i++)
449
            {
450
                if($this->methods[$i]->current === false)
451
                {
452
                    continue;
453
                }
454
455
                $ret = $this->methods[$i]->activatePendingUser($user);
456
                if($ret !== false)
457
                {
458
                    $this->impersonateUser($ret);
459
                    return true;
460
                }
461
            }
462
            return false;
463
        }
464
        $auth = $this->getMethodByName($methodName);
465
        return $auth->activatePendingUser($user);
466
    }
467
468
    /**
469
     * Get a current user by a password reset hash
@@ 476-502 (lines=27) @@
473
     *
474
     * @return Auth\User|false The user if the password reset hash is valid. Otherwise false.
475
     */
476
    public function getUserByResetHash($hash, $methodName = false)
477
    {
478
        if($methodName === false)
479
        {
480
            $count = count($this->methods);
481
            for($i = 0; $i < $count; $i++)
482
            {
483
                if($this->methods[$i]->current === false)
484
                {
485
                    continue;
486
                }
487
488
                $ret = $this->methods[$i]->getUserByResetHash($hash);
489
                if($ret !== false)
490
                {
491
                    return $ret;
492
                }
493
            }
494
            return false;
495
        }
496
        $auth = $this->getMethodByName($methodName);
497
        if($auth === false)
498
        {
499
            return $this->getUserByResetHash($hash, false);
500
        }
501
        return $auth->getUserByResetHash($hash);
502
    }
503
504
    /**
505
     * Get the Auth\Authenticator by host name