| Conditions | 3 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | public function minify($src) |
||
| 29 | { |
||
| 30 | $headers = ['Content-Type: application/octet-stream']; |
||
| 31 | $body = $src; |
||
| 32 | if (extension_loaded('zlib')) |
||
| 33 | { |
||
| 34 | $headers[] = 'Content-Encoding: gzip'; |
||
| 35 | $body = gzencode($body, $this->gzLevel); |
||
| 36 | } |
||
| 37 | |||
| 38 | $code = $this->httpClient->post($this->url, $headers, $body); |
||
| 39 | if ($code === false) |
||
| 40 | { |
||
| 41 | throw new RuntimeException; |
||
| 42 | } |
||
| 43 | |||
| 44 | return $code; |
||
| 45 | } |
||
| 46 | } |