Completed
Pull Request — master (#5)
by Márk
08:28
created

DecompressStream::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 8
Ratio 100 %

Importance

Changes 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 8
loc 8
rs 9.4286
cc 2
eloc 4
nc 2
nop 2
1
<?php
2
3
namespace Http\Message\Encoding;
4
5
use Psr\Http\Message\StreamInterface;
6
7
/**
8
 * Stream decompress (RFC 1950).
9
 *
10
 * @author Joel Wurtz <[email protected]>
11
 */
12 View Code Duplication
class DecompressStream extends FilteredStream
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
    public function __construct(StreamInterface $stream, $level = -1)
15
    {
16
        if (!extension_loaded('zlib')) {
17
            throw new \RuntimeException('The zlib extension must be enabled to use this stream');
18
        }
19
20
        parent::__construct($stream, ['window' => 15], ['window' => 15, 'level' => $level]);
21
    }
22
23
    public function getReadFilter()
24
    {
25
        return 'zlib.inflate';
26
    }
27
28
    public function getWriteFilter()
29
    {
30
        return 'zlib.deflate';
31
    }
32
}
33