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 = 36-41 lines in 2 locations

app/Repositories/ServerRepository.php 2 locations

@@ 431-471 (lines=41) @@
428
     * @param  array    $data
429
     * @return bool
430
     */
431
    public function updateContainer($id, array $data)
432
    {
433
        $validator = Validator::make($data, [
434
            'image' => 'required|string',
435
        ]);
436
437
        // Run validator, throw catchable and displayable exception if it fails.
438
        // Exception includes a JSON result of failed validation rules.
439
        if ($validator->fails()) {
440
            throw new DisplayValidationException($validator->errors());
441
        }
442
443
        DB::beginTransaction();
444
        try {
445
            $server = Models\Server::findOrFail($id);
446
447
            $server->image = $data['image'];
448
            $server->save();
449
450
            $server->node->guzzleClient([
451
                'X-Access-Server' => $server->uuid,
452
                'X-Access-Token' => $server->node->daemonSecret,
453
            ])->request('PATCH', '/server', [
454
                'json' => [
455
                    'build' => [
456
                        'image' => $server->image,
457
                    ],
458
                ],
459
            ]);
460
461
            DB::commit();
462
463
            return true;
464
        } catch (TransferException $ex) {
465
            DB::rollBack();
466
            throw new DisplayException('An error occured while attempting to update the container image.', $ex);
467
        } catch (\Exception $ex) {
468
            DB::rollBack();
469
            throw $ex;
470
        }
471
    }
472
473
    /**
474
     * [changeBuild description].
@@ 926-961 (lines=36) @@
923
        }
924
    }
925
926
    public function updateSFTPPassword($id, $password)
927
    {
928
        $server = Models\Server::with('node')->findOrFail($id);
929
930
        $validator = Validator::make(['password' => $password], [
931
            'password' => 'required|regex:/^((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})$/',
932
        ]);
933
934
        if ($validator->fails()) {
935
            throw new DisplayValidationException(json_encode($validator->errors()));
936
        }
937
938
        DB::beginTransaction();
939
        $server->sftp_password = Crypt::encrypt($password);
940
941
        try {
942
            $server->save();
943
944
            $server->node->guzzleClient([
945
                'X-Access-Token' => $server->node->daemonSecret,
946
                'X-Access-Server' => $server->uuid,
947
            ])->request('POST', '/server/password', [
948
                'json' => ['password' => $password],
949
            ]);
950
951
            DB::commit();
952
953
            return true;
954
        } catch (TransferException $ex) {
955
            DB::rollBack();
956
            throw new DisplayException('There was an error while attmping to contact the remote service to change the password.', $ex);
957
        } catch (\Exception $ex) {
958
            DB::rollBack();
959
            throw $ex;
960
        }
961
    }
962
}
963