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