| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 23 | 2 | public function minify($src) |
|
| 24 | { |
||
| 25 | 2 | $url = $this->url . $this->getHash($src); |
|
| 26 | 2 | if (extension_loaded('zlib')) |
|
| 27 | 2 | { |
|
| 28 | 2 | $url = 'compress.zlib://' . $url . '.gz'; |
|
| 29 | 2 | } |
|
| 30 | |||
| 31 | 2 | $contextOptions = ['http' => ['ignore_errors' => true]]; |
|
| 32 | 2 | $content = file_get_contents($url, false, stream_context_create($contextOptions)); |
|
| 33 | 2 | if (empty($http_response_header[0]) || strpos($http_response_header[0], '200') === false) |
|
| 34 | 2 | { |
|
| 35 | 1 | throw new RuntimeException; |
|
| 36 | } |
||
| 37 | |||
| 38 | 1 | return $content; |
|
| 39 | } |
||
| 40 | |||
| 51 | } |