Completed
Pull Request — master (#59)
by Antonio J.
03:17
created

GzipDecodeStream::getWriteFilter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Http\Message\Encoding;
4
5
use Psr\Http\Message\StreamInterface;
6
7
/**
8
 * Stream for decoding from gzip format (RFC 1952).
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 5
    public function __construct(StreamInterface $stream, $level = -1)
19
    {
20 5
        if (!extension_loaded('zlib')) {
21 1
            throw new \RuntimeException('The zlib extension must be enabled to use this stream');
22
        }
23
24 4
        parent::__construct($stream, ['window' => 31], ['window' => 31, 'level' => $level]);
0 ignored issues
show
Unused Code introduced by
The call to FilteredStream::__construct() has too many arguments starting with array('window' => 31, 'level' => $level).

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
25 4
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30 4
    public function getReadFilter()
31
    {
32 4
        return 'zlib.inflate';
33
    }
34
}
35