Issues (60)

code/DebugBarController.php (1 issue)

1
<?php
2
3
namespace LeKoala\DebugBar;
4
5
use DebugBar\OpenHandler;
6
use SilverStripe\Control\Controller;
7
use SilverStripe\Control\HTTPRequest;
8
9
/**
10
 * A open handler controller for DebugBar
11
 *
12
 * @author Koala
13
 */
14
class DebugBarController extends Controller
15
{
16
    public function index(HTTPRequest $request)
17
    {
18
        if (!DebugBar::config()->get('enable_storage')) {
19
            return $this->httpError(404, 'Storage not enabled');
20
        }
21
        $debugbar = DebugBar::getDebugBar();
22
        if (!$debugbar) {
0 ignored issues
show
$debugbar is of type DebugBar\DebugBar, thus it always evaluated to true.
Loading history...
23
            return $this->httpError(404, 'DebugBar not enabled');
24
        }
25
        $openHandler = new OpenHandler($debugbar);
26
        $openHandler->handle();
27
        exit(); // Handle will echo and set headers
28
    }
29
}
30