Issues (49)

code/DebugBarController.php (3 issues)

1
<?php
2
3
namespace LeKoala\DebugBar;
4
5
use DebugBar\OpenHandler;
6
use LeKoala\DebugBar\DebugBar;
7
use SilverStripe\Control\Controller;
8
use SilverStripe\Control\HTTPRequest;
9
10
/**
11
 * A open handler controller for DebugBar
12
 *
13
 * @author Koala
14
 */
15
class DebugBarController extends Controller
16
{
17
    public function index(HTTPRequest $request)
0 ignored issues
show
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

17
    public function index(/** @scrutinizer ignore-unused */ HTTPRequest $request)

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

Loading history...
18
    {
19
        if (!DebugBar::config()->get('enable_storage')) {
20
            return $this->httpError(404, 'Storage not enabled');
21
        }
22
        $debugbar = DebugBar::getDebugBar();
23
        if (!$debugbar) {
0 ignored issues
show
$debugbar is of type DebugBar\DebugBar, thus it always evaluated to true.
Loading history...
24
            return $this->httpError(404, 'DebugBar not enabled');
25
        }
26
        $openHandler = new OpenHandler($debugbar);
27
        $openHandler->handle();
28
        exit(); // Handle will echo and set headers
0 ignored issues
show
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
29
    }
30
}
31