Completed
Pull Request — master (#5)
by Márk
02:19 queued 18s
created

CompressStream::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 8
loc 8
ccs 5
cts 5
cp 1
rs 9.4286
cc 2
eloc 4
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Http\Message\Encoding;
4
5
use Psr\Http\Message\StreamInterface;
6
7
/**
8
 * Stream compress (RFC 1950).
9
 *
10
 * @author Joel Wurtz <[email protected]>
11
 */
12 View Code Duplication
class CompressStream 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 5
    public function __construct(StreamInterface $stream, $level = -1)
15
    {
16 5
        if (!extension_loaded('zlib')) {
17 1
            throw new \RuntimeException('The zlib extension must be enabled to use this stream');
18
        }
19
20 4
        parent::__construct($stream, ['window' => 15, 'level' => $level], ['window' => 15]);
21 4
    }
22
23 4
    public function getReadFilter()
24
    {
25 4
        return 'zlib.deflate';
26
    }
27
28 4
    public function getWriteFilter()
29
    {
30 4
        return 'zlib.inflate';
31
    }
32
}
33