Conditions | 4 |
Paths | 1 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | public function __construct(ConnectionInterface $src) |
||
15 | { |
||
16 | $this->src = $src; |
||
17 | $src->on('data', function ($data) { |
||
18 | $this->buffer .= $data; |
||
19 | if ($this->dst) { |
||
20 | $this->dst->write($this->buffer); |
||
21 | $this->buffer = ''; |
||
22 | } |
||
23 | }); |
||
24 | $src->on('end', function () { |
||
25 | $this->end = true; |
||
26 | if ($this->dst) { |
||
27 | $this->dst->end(); |
||
28 | } |
||
29 | }); |
||
30 | $src->on('error', function () { |
||
31 | $this->end = true; |
||
32 | if ($this->dst) { |
||
33 | $this->dst->end(); |
||
34 | } |
||
35 | }); |
||
36 | } |
||
37 | |||
50 |