Conditions | 4 |
Paths | 5 |
Total Lines | 21 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | public function handle(Request $request, Closure $next) |
||
18 | { |
||
19 | $response = $next($request); |
||
20 | |||
21 | if (!$this->compressionPossible($request, $response)) { |
||
22 | return $response; |
||
23 | } |
||
24 | |||
25 | $html = $response->getContent(); |
||
26 | |||
27 | if (class_exists('\BeyondCode\ServerTiming\Facades\ServerTiming')) { |
||
28 | \BeyondCode\ServerTiming\Facades\ServerTiming::start('Minification'); |
||
29 | } |
||
30 | |||
31 | $htmlMin = HtmlMin::minify($html); |
||
32 | |||
33 | if (class_exists('\BeyondCode\ServerTiming\Facades\ServerTiming')) { |
||
34 | \BeyondCode\ServerTiming\Facades\ServerTiming::stop('Minification'); |
||
35 | } |
||
36 | |||
37 | return $response->setContent($htmlMin); |
||
38 | } |
||
66 |