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

ChunkStream   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getReadFilter() 0 4 1
A fill() 0 8 2
1
<?php
2
3
namespace Http\Message\Encoding;
4
5
/**
6
 * Transform a regular stream into a chunked one.
7
 *
8
 * @author Joel Wurtz <[email protected]>
9
 */
10
class ChunkStream extends FilteredStream
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15 4
    public function getReadFilter()
16
    {
17 4
        return 'chunk';
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23 2
    protected function fill()
24
    {
25 2
        parent::fill();
26
27 2
        if ($this->stream->eof()) {
28 2
            $this->buffer .= "0\r\n\r\n";
29 2
        }
30 2
    }
31
}
32