GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Code Duplication    Length = 17-19 lines in 2 locations

src/Api/ConnectionsModule.php 1 location

@@ 120-138 (lines=19) @@
117
        return new ApiResponse('disconnect');
118
    }
119
120
    public function verifyOtp(Request $request)
121
    {
122
        $commonName = InputValidation::commonName($request->getPostParameter('common_name'));
123
        // we do not need 'otp_type', as only 'totp' is supported at the moment
124
        InputValidation::otpType($request->getPostParameter('otp_type'));
125
        $totpKey = InputValidation::totpKey($request->getPostParameter('totp_key'));
126
127
        $certInfo = $this->storage->getUserCertificateInfo($commonName);
128
        $userId = $certInfo['user_id'];
129
130
        $twoFactor = new TwoFactor($this->storage, new DateTime('now'));
131
        try {
132
            $twoFactor->verifyTotp($userId, $totpKey);
133
        } catch (TwoFactorException $e) {
134
            return new ApiErrorResponse('verify_otp', $e->getMessage());
135
        }
136
137
        return new ApiResponse('verify_otp');
138
    }
139
140
    private function verifyConnection($profileId, $commonName)
141
    {

src/Api/UsersModule.php 1 location

@@ 60-76 (lines=17) @@
57
58
        $service->post(
59
            '/set_totp_secret',
60
            function (Request $request, array $hookData) {
61
                AuthUtils::requireUser($hookData, ['vpn-user-portal']);
62
63
                $userId = InputValidation::userId($request->getPostParameter('user_id'));
64
                $totpKey = InputValidation::totpKey($request->getPostParameter('totp_key'));
65
                $totpSecret = InputValidation::totpSecret($request->getPostParameter('totp_secret'));
66
67
                $twoFactor = new TwoFactor($this->storage, new DateTime('now'));
68
                try {
69
                    $twoFactor->verifyTotp($userId, $totpKey, $totpSecret);
70
                } catch (TwoFactorException $e) {
71
                    return new ApiErrorResponse('set_totp_secret', $e->getMessage());
72
                }
73
                $this->storage->setTotpSecret($userId, $totpSecret);
74
75
                return new ApiResponse('set_totp_secret');
76
            }
77
        );
78
79
        $service->post(