Code Duplication    Length = 11-11 lines in 2 locations

src/models/queries/AdminQuery.php 2 locations

@@ 39-49 (lines=11) @@
36
     * @param string $token the password reset token
37
     * @return AdminQuery the query with conditions for valid password reset token applied
38
     */
39
    public function passwordResetToken($token)
40
    {
41
        $expire = \Yii::$app->params['user.passwordResetTokenExpire'];
42
        $parts = explode('_', $token);
43
        $timestamp = (int) end($parts);
44
        if ($timestamp + $expire < time()) {
45
            // token expired
46
            return $this->andWhere('FALSE');
47
        }
48
        return $this->andWhere(['password_reset_token' => $token]);
49
    }
50
51
    /**
52
     * @param string $token the email confirmation token
@@ 55-65 (lines=11) @@
52
     * @param string $token the email confirmation token
53
     * @return AdminQuery the query with conditions for valid email confirmation token applied
54
     */
55
    public function emailConfirmationToken($token)
56
    {
57
        $expire = \Yii::$app->params['user.emailConfirmationTokenExpire'];
58
        $parts = explode('_', $token);
59
        $timestamp = (int) end($parts);
60
        if ($timestamp + $expire < time()) {
61
            // token expired
62
            return $this->andWhere('FALSE');
63
        }
64
        return $this->andWhere(['email_confirmation_token' => $token]);
65
    }
66
}
67