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

app/Http/Controllers/Server/TaskController.php 2 locations

@@ 120-144 (lines=25) @@
117
     * @param  int                       $id
118
     * @return \Illuminate\Http\JsonResponse
119
     */
120
    public function delete(Request $request, $uuid, $id)
121
    {
122
        $server = Models\Server::byUuid($uuid)->load('tasks');
123
        $this->authorize('delete-task', $server);
124
125
        $task = $server->tasks->where('id', $id)->first();
126
        if (! $task) {
127
            return response()->json([
128
                'error' => 'No task by that ID was found associated with this server.',
129
            ], 404);
130
        }
131
132
        try {
133
            $repo = new Repositories\TaskRepository;
134
            $repo->delete($id);
135
136
            return response()->json([], 204);
137
        } catch (\Exception $ex) {
138
            Log::error($ex);
139
140
            return response()->json([
141
                'error' => 'A server error occured while attempting to delete this task.',
142
            ], 503);
143
        }
144
    }
145
146
    /**
147
     * Toggle the status of a task.
@@ 154-180 (lines=27) @@
151
     * @param  int                       $id
152
     * @return \Illuminate\Http\JsonResponse
153
     */
154
    public function toggle(Request $request, $uuid, $id)
155
    {
156
        $server = Models\Server::byUuid($uuid)->load('tasks');
157
        $this->authorize('toggle-task', $server);
158
159
        $task = $server->tasks->where('id', $id)->first();
160
        if (! $task) {
161
            return response()->json([
162
                'error' => 'No task by that ID was found associated with this server.',
163
            ], 404);
164
        }
165
166
        try {
167
            $repo = new Repositories\TaskRepository;
168
            $resp = $repo->toggle($id);
169
170
            return response()->json([
171
                'status' => $resp,
172
            ]);
173
        } catch (\Exception $ex) {
174
            Log::error($ex);
175
176
            return response()->json([
177
                'error' => 'A server error occured while attempting to toggle this task.',
178
            ], 503);
179
        }
180
    }
181
}
182