Code Duplication    Length = 21-24 lines in 2 locations

class.AuthProvider.php 2 locations

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