Issues (49)

code/DebugBarController.php (1 issue)

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)
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
29
    }
30
}
31