Total Complexity | 4 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class CompressStream extends FilteredStream |
||
14 | { |
||
15 | /** |
||
16 | * @param int $level |
||
17 | */ |
||
18 | public function __construct(StreamInterface $stream, $level = -1) |
||
19 | 6 | { |
|
20 | if (!extension_loaded('zlib')) { |
||
21 | 6 | throw new \RuntimeException('The zlib extension must be enabled to use this stream'); |
|
22 | 1 | } |
|
23 | |||
24 | parent::__construct($stream, ['window' => 15, 'level' => $level]); |
||
25 | 5 | ||
26 | // @deprecated will be removed in 2.0 |
||
27 | $this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => 15]); |
||
28 | 5 | } |
|
29 | 5 | ||
30 | /** |
||
31 | * {@inheritdoc} |
||
32 | */ |
||
33 | protected function readFilter() |
||
34 | 5 | { |
|
35 | return 'zlib.deflate'; |
||
36 | 5 | } |
|
37 | |||
38 | /** |
||
39 | * {@inheritdoc} |
||
40 | */ |
||
41 | protected function writeFilter() |
||
44 | 5 | } |
|
45 | } |
||
46 |