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.

ServerController::getDatabases()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
dl 14
loc 14
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 2
1
<?php
2
/**
3
 * Pterodactyl - Panel
4
 * Copyright (c) 2015 - 2017 Dane Everitt <[email protected]>.
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7
 * of this software and associated documentation files (the "Software"), to deal
8
 * in the Software without restriction, including without limitation the rights
9
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
 * copies of the Software, and to permit persons to whom the Software is
11
 * furnished to do so, subject to the following conditions:
12
 *
13
 * The above copyright notice and this permission notice shall be included in all
14
 * copies or substantial portions of the Software.
15
 *
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
 * SOFTWARE.
23
 */
24
25
namespace Pterodactyl\Http\Controllers\Server;
26
27
use Log;
28
use Alert;
29
use Cache;
30
use Pterodactyl\Models;
31
use Illuminate\Http\Request;
32
use Pterodactyl\Exceptions\DisplayException;
33
use Pterodactyl\Http\Controllers\Controller;
34
use Pterodactyl\Repositories\ServerRepository;
35
use Pterodactyl\Repositories\Daemon\FileRepository;
36
use Pterodactyl\Exceptions\DisplayValidationException;
37
38
class ServerController extends Controller
39
{
40
    /**
41
     * Renders server index page for specified server.
42
     *
43
     * @param  \Illuminate\Http\Request  $request
44
     * @param  string                    $uuid
45
     * @return \Illuminate\View\View
46
     */
47
    public function getIndex(Request $request, $uuid)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
48
    {
49
        $server = Models\Server::byUuid($uuid);
50
51
        $server->js([
52
            'meta' => [
53
                'saveFile' => route('server.files.save', $server->uuidShort),
54
                'csrfToken' => csrf_token(),
55
            ],
56
            'config' => [
57
                'console_count' => config('pterodactyl.console.count'),
58
                'console_freq' => config('pterodactyl.console.frequency'),
59
            ],
60
        ]);
61
62
        return view('server.index', [
0 ignored issues
show
Bug Compatibility introduced by
The expression view('server.index', arr...de' => $server->node)); of type Illuminate\View\View|Ill...\Contracts\View\Factory adds the type Illuminate\Contracts\View\Factory to the return on line 62 which is incompatible with the return type documented by Pterodactyl\Http\Control...verController::getIndex of type Illuminate\View\View.
Loading history...
63
            'server' => $server,
64
            'node' => $server->node,
65
        ]);
66
    }
67
68
    /**
69
     * Renders server console as an individual item.
70
     *
71
     * @param  \Illuminate\Http\Request  $request
72
     * @param  string                    $uuid
73
     * @return \Illuminate\View\View
74
     */
75
    public function getConsole(Request $request, $uuid)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
76
    {
77
        \Debugbar::disable();
78
        $server = Models\Server::byUuid($uuid);
79
80
        $server->js([
81
            'config' => [
82
                'console_count' => config('pterodactyl.console.count'),
83
                'console_freq' => config('pterodactyl.console.frequency'),
84
            ],
85
        ]);
86
87
        return view('server.console', [
0 ignored issues
show
Bug Compatibility introduced by
The expression view('server.console', a...de' => $server->node)); of type Illuminate\View\View|Ill...\Contracts\View\Factory adds the type Illuminate\Contracts\View\Factory to the return on line 87 which is incompatible with the return type documented by Pterodactyl\Http\Control...rController::getConsole of type Illuminate\View\View.
Loading history...
88
            'server' => $server,
89
            'node' => $server->node,
90
        ]);
91
    }
92
93
    /**
94
     * Renders file overview page.
95
     *
96
     * @param  \Illuminate\Http\Request  $request
97
     * @param  string                    $uuid
98
     * @return \Illuminate\View\View
99
     */
100
    public function getFiles(Request $request, $uuid)
101
    {
102
        $server = Models\Server::byUuid($uuid);
103
        $this->authorize('list-files', $server);
104
105
        $server->js([
106
            'meta' => [
107
                'directoryList' => route('server.files.directory-list', $server->uuidShort),
108
                'csrftoken' => csrf_token(),
109
            ],
110
            'permissions' => [
111
                'moveFiles' => $request->user()->can('move-files', $server),
112
                'copyFiles' => $request->user()->can('copy-files', $server),
113
                'compressFiles' => $request->user()->can('compress-files', $server),
114
                'decompressFiles' => $request->user()->can('decompress-files', $server),
115
                'createFiles' => $request->user()->can('create-files', $server),
116
                'downloadFiles' => $request->user()->can('download-files', $server),
117
                'deleteFiles' => $request->user()->can('delete-files', $server),
118
            ],
119
        ]);
120
121
        return view('server.files.index', [
0 ignored issues
show
Bug Compatibility introduced by
The expression view('server.files.index...de' => $server->node)); of type Illuminate\View\View|Ill...\Contracts\View\Factory adds the type Illuminate\Contracts\View\Factory to the return on line 121 which is incompatible with the return type documented by Pterodactyl\Http\Control...verController::getFiles of type Illuminate\View\View.
Loading history...
122
            'server' => $server,
123
            'node' => $server->node,
124
        ]);
125
    }
126
127
    /**
128
     * Renders add file page.
129
     *
130
     * @param  \Illuminate\Http\Request  $request
131
     * @param  string                    $uuid
132
     * @return \Illuminate\View\View
133
     */
134 View Code Duplication
    public function getAddFile(Request $request, $uuid)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
135
    {
136
        $server = Models\Server::byUuid($uuid);
137
        $this->authorize('create-files', $server);
138
139
        $server->js();
140
141
        return view('server.files.add', [
0 ignored issues
show
Bug Compatibility introduced by
The expression view('server.files.add',...t('dir'), '/') . '/')); of type Illuminate\View\View|Ill...\Contracts\View\Factory adds the type Illuminate\Contracts\View\Factory to the return on line 141 which is incompatible with the return type documented by Pterodactyl\Http\Control...rController::getAddFile of type Illuminate\View\View.
Loading history...
142
            'server' => $server,
143
            'node' => $server->node,
144
            'directory' => (in_array($request->get('dir'), [null, '/', ''])) ? '' : trim($request->get('dir'), '/') . '/',
145
        ]);
146
    }
147
148
    /**
149
     * Renders edit file page for a given file.
150
     *
151
     * @param  \Illuminate\Http\Request  $request
152
     * @param  string                    $uuid
153
     * @param  string                    $file
154
     * @return \Illuminate\View\View
155
     */
156
    public function getEditFile(Request $request, $uuid, $file)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
157
    {
158
        $server = Models\Server::byUuid($uuid);
159
        $this->authorize('edit-files', $server);
160
161
        $fileInfo = (object) pathinfo($file);
162
        $controller = new FileRepository($uuid);
163
164
        try {
165
            $fileContent = $controller->returnFileContents($file);
166
        } catch (DisplayException $ex) {
167
            Alert::danger($ex->getMessage())->flash();
168
169
            return redirect()->route('server.files.index', $uuid);
0 ignored issues
show
Documentation introduced by
$uuid is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Bug Best Practice introduced by
The return type of return redirect()->route...r.files.index', $uuid); (Illuminate\Http\RedirectResponse) is incompatible with the return type documented by Pterodactyl\Http\Control...Controller::getEditFile of type Illuminate\View\View.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
170
        } catch (\Exception $ex) {
171
            Log::error($ex);
172
            Alert::danger('An error occured while attempting to load the requested file for editing, please try again.')->flash();
173
174
            return redirect()->route('server.files.index', $uuid);
0 ignored issues
show
Documentation introduced by
$uuid is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Bug Best Practice introduced by
The return type of return redirect()->route...r.files.index', $uuid); (Illuminate\Http\RedirectResponse) is incompatible with the return type documented by Pterodactyl\Http\Control...Controller::getEditFile of type Illuminate\View\View.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
175
        }
176
177
        $server->js([
178
            'stat' => $fileContent['stat'],
179
        ]);
180
181
        return view('server.files.edit', [
0 ignored issues
show
Bug Compatibility introduced by
The expression view('server.files.edit'...>dirname, '/') . '/')); of type Illuminate\View\View|Ill...\Contracts\View\Factory adds the type Illuminate\Contracts\View\Factory to the return on line 181 which is incompatible with the return type documented by Pterodactyl\Http\Control...Controller::getEditFile of type Illuminate\View\View.
Loading history...
182
            'server' => $server,
183
            'node' => $server->node,
184
            'file' => $file,
185
            'stat' => $fileContent['stat'],
186
            'contents' => $fileContent['file']->content,
187
            'directory' => (in_array($fileInfo->dirname, ['.', './', '/'])) ? '/' : trim($fileInfo->dirname, '/') . '/',
188
        ]);
189
    }
190
191
    /**
192
     * Handles downloading a file for the user.
193
     *
194
     * @param  \Illuminate\Http\Request  $request
195
     * @param  string                    $uuid
196
     * @param  string                    $file
197
     * @return \Illuminate\View\View
198
     */
199
    public function getDownloadFile(Request $request, $uuid, $file)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
200
    {
201
        $server = Models\Server::byUuid($uuid);
202
        $this->authorize('download-files', $server);
203
204
        $token = str_random(40);
205
        Cache::tags(['Server:Downloads'])->put($token, [
206
            'server' => $server->uuid,
207
            'path' => $file,
208
        ], 5);
209
210
        return redirect($server->node->scheme . '://' . $server->node->fqdn . ':' . $server->node->daemonListen . '/server/file/download/' . $token);
211
    }
212
213
    /**
214
     * Returns the allocation overview for a server.
215
     *
216
     * @param  \Illuminate\Http\Request  $request
217
     * @param  string                    $uuid
218
     * @return \Illuminate\View\View
219
     */
220
    public function getAllocation(Request $request, $uuid)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
221
    {
222
        $server = Models\Server::byUuid($uuid);
223
        $this->authorize('view-allocation', $server);
224
        $server->js();
225
226
        return view('server.settings.allocation', [
0 ignored issues
show
Bug Compatibility introduced by
The expression view('server.settings.al...de' => $server->node)); of type Illuminate\View\View|Ill...\Contracts\View\Factory adds the type Illuminate\Contracts\View\Factory to the return on line 226 which is incompatible with the return type documented by Pterodactyl\Http\Control...ntroller::getAllocation of type Illuminate\View\View.
Loading history...
227
            'server' => $server->load(['allocations' => function ($query) {
228
                $query->orderBy('ip', 'asc');
229
                $query->orderBy('port', 'asc');
230
            }]),
231
            'node' => $server->node,
232
        ]);
233
    }
234
235
    /**
236
     * Returns the startup overview for a server.
237
     *
238
     * @param  \Illuminate\Http\Request  $request
239
     * @param  string                    $uuid
240
     * @return \Illuminate\View\View
241
     */
242
    public function getStartup(Request $request, $uuid)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
243
    {
244
        $server = Models\Server::byUuid($uuid);
245
        $server->load(['node', 'allocation', 'variables.variable']);
246
247
        $this->authorize('view-startup', $server);
248
249
        $replacements = [
250
            '{{SERVER_MEMORY}}' => $server->memory,
251
            '{{SERVER_IP}}' => $server->allocation->ip,
252
            '{{SERVER_PORT}}' => $server->allocation->port,
253
        ];
254
255
        $processed = str_replace(array_keys($replacements), array_values($replacements), $server->startup);
256
        foreach ($server->variables as $v) {
257
            $replace = ($v->user_can_view) ? $v->variable_value : '[hidden]';
258
            $processed = str_replace('{{' . $v->variable->env_variable . '}}', $replace, $processed);
259
        }
260
261
        $server->js();
262
263
        return view('server.settings.startup', [
0 ignored issues
show
Bug Compatibility introduced by
The expression view('server.settings.st...artup' => $processed)); of type Illuminate\View\View|Ill...\Contracts\View\Factory adds the type Illuminate\Contracts\View\Factory to the return on line 263 which is incompatible with the return type documented by Pterodactyl\Http\Control...rController::getStartup of type Illuminate\View\View.
Loading history...
264
            'server' => $server,
265
            'node' => $server->node,
266
            'variables' => $server->variables->where('user_can_view', true),
267
            'service' => $server->service,
268
            'processedStartup' => $processed,
269
        ]);
270
    }
271
272
    /**
273
     * Returns the database overview for a server.
274
     *
275
     * @param  \Illuminate\Http\Request  $request
276
     * @param  string                    $uuid
277
     * @return \Illuminate\View\View
278
     */
279 View Code Duplication
    public function getDatabases(Request $request, $uuid)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
280
    {
281
        $server = Models\Server::byUuid($uuid);
282
        $this->authorize('view-databases', $server);
283
284
        $server->load('node', 'databases.host');
285
        $server->js();
286
287
        return view('server.settings.databases', [
0 ignored issues
show
Bug Compatibility introduced by
The expression view('server.settings.da...> $server->databases)); of type Illuminate\View\View|Ill...\Contracts\View\Factory adds the type Illuminate\Contracts\View\Factory to the return on line 287 which is incompatible with the return type documented by Pterodactyl\Http\Control...ontroller::getDatabases of type Illuminate\View\View.
Loading history...
288
            'server' => $server,
289
            'node' => $server->node,
290
            'databases' => $server->databases,
291
        ]);
292
    }
293
294
    /**
295
     * Returns the SFTP overview for a server.
296
     *
297
     * @param  \Illuminate\Http\Request  $request
298
     * @param  string                    $uuid
299
     * @return \Illuminate\View\View
300
     */
301 View Code Duplication
    public function getSFTP(Request $request, $uuid)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
302
    {
303
        $server = Models\Server::byUuid($uuid);
304
        $this->authorize('view-sftp', $server);
305
        $server->js();
306
307
        return view('server.settings.sftp', [
0 ignored issues
show
Bug Compatibility introduced by
The expression view('server.settings.sf...de' => $server->node)); of type Illuminate\View\View|Ill...\Contracts\View\Factory adds the type Illuminate\Contracts\View\Factory to the return on line 307 which is incompatible with the return type documented by Pterodactyl\Http\Control...rverController::getSFTP of type Illuminate\View\View.
Loading history...
308
            'server' => $server,
309
            'node' => $server->node,
310
        ]);
311
    }
312
313
    /**
314
     * Handles changing the SFTP password for a server.
315
     *
316
     * @param  \Illuminate\Http\Request  $request
317
     * @param  string                    $uuid
318
     * @return \Illuminate\Http\RedirectResponse
319
     */
320 View Code Duplication
    public function postSettingsSFTP(Request $request, $uuid)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
321
    {
322
        $server = Models\Server::byUuid($uuid);
323
        $this->authorize('reset-sftp', $server);
324
325
        try {
326
            $repo = new ServerRepository;
327
            $repo->updateSFTPPassword($server->id, $request->input('sftp_pass'));
0 ignored issues
show
Bug introduced by
It seems like $request->input('sftp_pass') targeting Illuminate\Http\Concerns...ractsWithInput::input() can also be of type array; however, Pterodactyl\Repositories...y::updateSFTPPassword() does only seem to accept string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
328
            Alert::success('Successfully updated this servers SFTP password.')->flash();
329
        } catch (DisplayValidationException $ex) {
330
            return redirect()->route('server.settings.sftp', $uuid)->withErrors(json_decode($ex->getMessage()));
0 ignored issues
show
Documentation introduced by
$uuid is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
331
        } catch (DisplayException $ex) {
332
            Alert::danger($ex->getMessage())->flash();
333
        } catch (\Exception $ex) {
334
            Log::error($ex);
335
            Alert::danger('An unknown error occured while attempting to update this server\'s SFTP settings.')->flash();
336
        }
337
338
        return redirect()->route('server.settings.sftp', $uuid);
0 ignored issues
show
Documentation introduced by
$uuid is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
339
    }
340
341
    /**
342
     * Handles changing the startup settings for a server.
343
     *
344
     * @param  \Illuminate\Http\Request  $request
345
     * @param  string                    $uuid
346
     * @return \Illuminate\Http\RedirectResponse
347
     */
348 View Code Duplication
    public function postSettingsStartup(Request $request, $uuid)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
349
    {
350
        $server = Models\Server::byUuid($uuid);
351
        $this->authorize('edit-startup', $server);
352
353
        try {
354
            $repo = new ServerRepository;
355
            $repo->updateStartup($server->id, $request->except('_token'));
356
            Alert::success('Server startup variables were successfully updated.')->flash();
357
        } catch (DisplayValidationException $ex) {
358
            return redirect()->route('server.settings.startup', $uuid)->withErrors(json_decode($ex->getMessage()));
0 ignored issues
show
Documentation introduced by
$uuid is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
359
        } catch (DisplayException $ex) {
360
            Alert::danger($ex->getMessage())->flash();
361
        } catch (\Exception $ex) {
362
            Log::error($ex);
363
            Alert::danger('An unhandled exception occured while attemping to update startup variables for this server. Please try again.')->flash();
364
        }
365
366
        return redirect()->route('server.settings.startup', $uuid);
0 ignored issues
show
Documentation introduced by
$uuid is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
367
    }
368
}
369