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