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 = 25-27 lines in 2 locations

src/Api/UsersModule.php 2 locations

@@ 66-90 (lines=25) @@
63
64
        $service->post(
65
            '/set_yubi_key_id',
66
            function (Request $request, array $hookData) {
67
                AuthUtils::requireUser($hookData, ['vpn-user-portal']);
68
69
                $userId = InputValidation::userId($request->getPostParameter('user_id'));
70
                $yubiKeyOtp = InputValidation::yubiKeyOtp($request->getPostParameter('yubi_key_otp'));
71
72
                // check if there is already a YubiKey ID registered for this user
73
                if ($this->storage->hasYubiKeyId($userId)) {
74
                    return new ApiErrorResponse('set_yubi_key_id', 'YubiKey ID already set');
75
                }
76
77
                $yubiKey = new YubiKey();
78
                try {
79
                    $yubiKeyId = $yubiKey->verify($userId, $yubiKeyOtp);
80
                    $this->storage->setYubiKeyId($userId, $yubiKeyId);
81
                    $this->storage->addUserMessage($userId, 'notification', sprintf('YubiKey ID "%s" registered', $yubiKeyId));
82
83
                    return new ApiResponse('set_yubi_key_id');
84
                } catch (YubiKeyException $e) {
85
                    $msg = sprintf('YubiKey OTP verification failed: %s', $e->getMessage());
86
                    $this->storage->addUserMessage($userId, 'notification', $msg);
87
88
                    return new ApiErrorResponse('set_yubi_key_id', $msg);
89
                }
90
            }
91
        );
92
93
        $service->post(
@@ 162-188 (lines=27) @@
159
160
        $service->post(
161
            '/set_totp_secret',
162
            function (Request $request, array $hookData) {
163
                AuthUtils::requireUser($hookData, ['vpn-user-portal']);
164
165
                $userId = InputValidation::userId($request->getPostParameter('user_id'));
166
                $totpKey = InputValidation::totpKey($request->getPostParameter('totp_key'));
167
                $totpSecret = InputValidation::totpSecret($request->getPostParameter('totp_secret'));
168
169
                // check if there is already a TOTP secret registered for this user
170
                if ($this->storage->hasTotpSecret($userId)) {
171
                    return new ApiErrorResponse('set_totp_secret', 'TOTP secret already set');
172
                }
173
174
                $totp = new Totp($this->storage);
175
                try {
176
                    $totp->verify($userId, $totpKey, $totpSecret);
177
                } catch (TotpException $e) {
178
                    $msg = sprintf('TOTP verification failed: %s', $e->getMessage());
179
                    $this->storage->addUserMessage($userId, 'notification', $msg);
180
181
                    return new ApiErrorResponse('set_totp_secret', $msg);
182
                }
183
184
                $this->storage->setTotpSecret($userId, $totpSecret);
185
                $this->storage->addUserMessage($userId, 'notification', 'TOTP secret registered');
186
187
                return new ApiResponse('set_totp_secret');
188
            }
189
        );
190
191
        $service->post(