Chunk   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 19
ccs 9
cts 9
cp 1
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A filter() 0 14 2
1
<?php
2
3
namespace Http\Message\Encoding\Filter;
4
5
/**
6
 * Userland implementation of the chunk stream filter.
7
 *
8
 * @author Joel Wurtz <[email protected]>
9
 */
10
class Chunk extends \php_user_filter
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15 2
    public function filter($in, $out, &$consumed, $closing)
16
    {
17 2
        while ($bucket = stream_bucket_make_writeable($in)) {
18 2
            $lenbucket = stream_bucket_new($this->stream, dechex($bucket->datalen)."\r\n");
0 ignored issues
show
Bug Best Practice introduced by
The property stream does not exist on Http\Message\Encoding\Filter\Chunk. Did you maybe forget to declare it?
Loading history...
19 2
            stream_bucket_append($out, $lenbucket);
20
21 2
            $consumed += $bucket->datalen;
22 2
            stream_bucket_append($out, $bucket);
23
24 2
            $lenbucket = stream_bucket_new($this->stream, "\r\n");
25 2
            stream_bucket_append($out, $lenbucket);
26
        }
27
28 2
        return PSFS_PASS_ON;
29
    }
30
}
31