|
4 | 4 |
|
5 | 5 | namespace ZipStream; |
6 | 6 |
|
| 7 | +/** |
| 8 | + * @deprecated |
| 9 | + */ |
7 | 10 | class DeflateStream extends Stream |
8 | 11 | { |
9 | | - protected $filter; |
10 | | - |
11 | | - /** |
12 | | - * @var Option\File |
13 | | - */ |
14 | | - protected $options; |
15 | | - |
16 | | - /** |
17 | | - * Rewind stream |
18 | | - * |
19 | | - * @return void |
20 | | - */ |
21 | | - public function rewind(): void |
| 12 | + public function __construct($stream) |
22 | 13 | { |
23 | | - // deflate filter needs to be removed before rewind |
24 | | - if ($this->filter) { |
25 | | - $this->removeDeflateFilter(); |
26 | | - $this->seek(0); |
27 | | - $this->addDeflateFilter($this->options); |
28 | | - } else { |
29 | | - rewind($this->stream); |
30 | | - } |
| 14 | + parent::__construct($stream); |
| 15 | + trigger_error('Class ' . __CLASS__ . ' is deprecated, delation will be handled internally instead', E_USER_DEPRECATED); |
31 | 16 | } |
32 | 17 |
|
33 | | - /** |
34 | | - * Remove the deflate filter |
35 | | - * |
36 | | - * @return void |
37 | | - */ |
38 | 18 | public function removeDeflateFilter(): void |
39 | 19 | { |
40 | | - if (!$this->filter) { |
41 | | - return; |
42 | | - } |
43 | | - stream_filter_remove($this->filter); |
44 | | - $this->filter = null; |
| 20 | + trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); |
45 | 21 | } |
46 | 22 |
|
47 | | - /** |
48 | | - * Add a deflate filter |
49 | | - * |
50 | | - * @param Option\File $options |
51 | | - * @return void |
52 | | - */ |
53 | 23 | public function addDeflateFilter(Option\File $options): void |
54 | 24 | { |
55 | | - $this->options = $options; |
56 | | - // parameter 4 for stream_filter_append expects array |
57 | | - // so we convert the option object in an array |
58 | | - $optionsArr = [ |
59 | | - 'comment' => $options->getComment(), |
60 | | - 'method' => $options->getMethod(), |
61 | | - 'deflateLevel' => $options->getDeflateLevel(), |
62 | | - 'time' => $options->getTime(), |
63 | | - ]; |
64 | | - $this->filter = stream_filter_append( |
65 | | - $this->stream, |
66 | | - 'zlib.deflate', |
67 | | - STREAM_FILTER_READ, |
68 | | - $optionsArr |
69 | | - ); |
| 25 | + trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); |
70 | 26 | } |
71 | 27 | } |
0 commit comments