| @@ 12-32 (lines=21) @@ | ||
| 9 | * |
|
| 10 | * @author Joel Wurtz <[email protected]> |
|
| 11 | */ |
|
| 12 | class CompressStream extends FilteredStream |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * @param StreamInterface $stream |
|
| 16 | * @param int $level |
|
| 17 | */ |
|
| 18 | public function __construct(StreamInterface $stream, $level = -1) |
|
| 19 | { |
|
| 20 | if (!extension_loaded('zlib')) { |
|
| 21 | throw new \RuntimeException('The zlib extension must be enabled to use this stream'); |
|
| 22 | } |
|
| 23 | ||
| 24 | parent::__construct($stream, ['window' => 15, 'level' => $level], ['window' => 15]); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * {@inheritdoc} |
|
| 29 | */ |
|
| 30 | protected function readFilter() |
|
| 31 | { |
|
| 32 | return 'zlib.deflate'; |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| @@ 12-32 (lines=21) @@ | ||
| 9 | * |
|
| 10 | * @author Joel Wurtz <[email protected]> |
|
| 11 | */ |
|
| 12 | class DecompressStream extends FilteredStream |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * @param StreamInterface $stream |
|
| 16 | * @param int $level |
|
| 17 | */ |
|
| 18 | public function __construct(StreamInterface $stream, $level = -1) |
|
| 19 | { |
|
| 20 | if (!extension_loaded('zlib')) { |
|
| 21 | throw new \RuntimeException('The zlib extension must be enabled to use this stream'); |
|
| 22 | } |
|
| 23 | ||
| 24 | parent::__construct($stream, ['window' => 15], ['window' => 15, 'level' => $level]); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * {@inheritdoc} |
|
| 29 | */ |
|
| 30 | protected function readFilter() |
|
| 31 | { |
|
| 32 | return 'zlib.inflate'; |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| @@ 12-32 (lines=21) @@ | ||
| 9 | * |
|
| 10 | * @author Joel Wurtz <[email protected]> |
|
| 11 | */ |
|
| 12 | class GzipDecodeStream extends FilteredStream |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * @param StreamInterface $stream |
|
| 16 | * @param int $level |
|
| 17 | */ |
|
| 18 | public function __construct(StreamInterface $stream, $level = -1) |
|
| 19 | { |
|
| 20 | if (!extension_loaded('zlib')) { |
|
| 21 | throw new \RuntimeException('The zlib extension must be enabled to use this stream'); |
|
| 22 | } |
|
| 23 | ||
| 24 | parent::__construct($stream, ['window' => 31], ['window' => 31, 'level' => $level]); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * {@inheritdoc} |
|
| 29 | */ |
|
| 30 | protected function readFilter() |
|
| 31 | { |
|
| 32 | return 'zlib.inflate'; |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| @@ 12-38 (lines=27) @@ | ||
| 9 | * |
|
| 10 | * @author Joel Wurtz <[email protected]> |
|
| 11 | */ |
|
| 12 | class GzipEncodeStream extends FilteredStream |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * @param StreamInterface $stream |
|
| 16 | * @param int $level |
|
| 17 | */ |
|
| 18 | public function __construct(StreamInterface $stream, $level = -1) |
|
| 19 | { |
|
| 20 | if (!extension_loaded('zlib')) { |
|
| 21 | throw new \RuntimeException('The zlib extension must be enabled to use this stream'); |
|
| 22 | } |
|
| 23 | ||
| 24 | parent::__construct($stream, ['window' => 31, 'level' => $level], ['window' => 31]); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * {@inheritdoc} |
|
| 29 | */ |
|
| 30 | protected function readFilter() |
|
| 31 | { |
|
| 32 | return 'zlib.deflate'; |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * {@inheritdoc} |
|
| 37 | */ |
|
| 38 | protected function writeFilter() |
|
| 39 | { |
|
| 40 | return 'zlib.inflate'; |
|
| 41 | } |
|
| @@ 12-32 (lines=21) @@ | ||
| 9 | * |
|
| 10 | * @author Joel Wurtz <[email protected]> |
|
| 11 | */ |
|
| 12 | class InflateStream extends FilteredStream |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * @param StreamInterface $stream |
|
| 16 | * @param int $level |
|
| 17 | */ |
|
| 18 | public function __construct(StreamInterface $stream, $level = -1) |
|
| 19 | { |
|
| 20 | if (!extension_loaded('zlib')) { |
|
| 21 | throw new \RuntimeException('The zlib extension must be enabled to use this stream'); |
|
| 22 | } |
|
| 23 | ||
| 24 | parent::__construct($stream, ['window' => -15], ['window' => -15, 'level' => $level]); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * {@inheritdoc} |
|
| 29 | */ |
|
| 30 | protected function readFilter() |
|
| 31 | { |
|
| 32 | return 'zlib.inflate'; |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|