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