Completed
Pull Request — master (#5)
by Márk
03:36
created

DechunkStream   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 22
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getReadFilter() 0 4 1
A getWriteFilter() 0 8 2
1
<?php
2
3
namespace Http\Message\Encoding;
4
5
/**
6
 * Decorate a stream which is chunked.
7
 *
8
 * Allow to decode a chunked stream
9
 *
10
 * @author Joel Wurtz <[email protected]>
11
 */
12
class DechunkStream extends FilteredStream
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17 4
    public function getReadFilter()
18
    {
19 4
        return 'dechunk';
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25 4
    public function getWriteFilter()
26
    {
27 4
        if (!array_key_exists('chunk', stream_get_filters())) {
28 4
            stream_filter_register('chunk', 'Http\Encoding\Filter\Chunk');
29 4
        }
30
31 4
        return 'chunk';
32
    }
33
}
34