Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | public function handle($request, $next) |
||
11 | { |
||
12 | $response = $next($request); |
||
13 | |||
14 | if ($response instanceof JsonResponse) { |
||
15 | $compressedResponse = new Response(); |
||
16 | $compressed = $this->compress($response->getContent()); |
||
17 | $compressedResponse->setContent($compressed); |
||
18 | $compressedResponse->withHeaders($this->headers()); |
||
19 | $compressedResponse->header('Content-Length', strlen($compressed)); |
||
20 | |||
21 | $this->setZlib(); |
||
22 | |||
23 | return $compressedResponse; |
||
24 | } |
||
25 | |||
26 | return $response; |
||
27 | } |
||
49 |