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].
@@ 928-963 (lines=36) @@
925
        }
926
    }
927
928
    public function updateSFTPPassword($id, $password)
929
    {
930
        $server = Models\Server::with('node')->findOrFail($id);
931
932
        $validator = Validator::make(['password' => $password], [
933
            'password' => 'required|regex:/^((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})$/',
934
        ]);
935
936
        if ($validator->fails()) {
937
            throw new DisplayValidationException(json_encode($validator->errors()));
938
        }
939
940
        DB::beginTransaction();
941
        $server->sftp_password = Crypt::encrypt($password);
942
943
        try {
944
            $server->save();
945
946
            $server->node->guzzleClient([
947
                'X-Access-Token' => $server->node->daemonSecret,
948
                'X-Access-Server' => $server->uuid,
949
            ])->request('POST', '/server/password', [
950
                'json' => ['password' => $password],
951
            ]);
952
953
            DB::commit();
954
955
            return true;
956
        } catch (TransferException $ex) {
957
            DB::rollBack();
958
            throw new DisplayException('There was an error while attmping to contact the remote service to change the password.', $ex);
959
        } catch (\Exception $ex) {
960
            DB::rollBack();
961
            throw $ex;
962
        }
963
    }
964
}
965