Conditions | 3 |
Paths | 1 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3.1406 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
30 | public function __construct(ObservableInterface $observable) |
||
31 | { |
||
32 | 1 | $observable->subscribe(function ($item) { |
|
33 | 1 | if ($this->deferred instanceof Deferred) { |
|
34 | $this->deferred->resolve($item); |
||
35 | $this->deferred = null; |
||
36 | |||
37 | return; |
||
38 | } |
||
39 | |||
40 | 1 | $this->queue[] = $item; |
|
41 | }, null, function () { |
||
42 | 2 | $this->done = true; |
|
43 | |||
44 | 2 | if ($this->deferred instanceof Deferred) { |
|
45 | 1 | $this->deferred->resolve(); |
|
46 | 1 | $this->deferred = null; |
|
47 | } |
||
48 | 2 | }); |
|
49 | 2 | } |
|
50 | |||
66 |