aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/debugbar.php
blob: 3f43bd28feb9bfa0243341f4692805373b45744a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
final class DebugbarController extends StudipController
{
    public function __construct(
        Trails\Dispatcher $dispatcher,
        private readonly DebugBar\DebugBar $debugbar
    ) {
        parent::__construct($dispatcher);
    }

    public function css_action(): void
    {
        $this->response->add_header('Content-Type', 'text/css;charset=utf-8');

        ob_start();
        $this->debugbar->getJavascriptRenderer()->dumpCssAssets();
        $content = ob_get_contents();
        ob_end_clean();
        $this->render_text($content);

    }

    public function js_action(): void
    {
        $this->response->add_header('Content-Type', 'text/javascript;charset=utf-8');
        ob_start();
        $this->debugbar->getJavascriptRenderer()->setIncludeVendors(false)->dumpJsAssets();
        $content = ob_get_contents();
        ob_end_clean();
        $this->render_text($content);
    }
}