| 1 | <?php declare(strict_types=1); |
||
| 10 | |||
| 11 | class Factory |
||
| 12 | { |
||
| 13 | private EventFactory $eventFactory; |
||
|
|
|||
| 14 | |||
| 15 | private LoggerInterface $logger; |
||
| 16 | |||
| 17 | 2 | public function __construct(EventFactory $eventFactory, LoggerInterface $logger) |
|
| 18 | { |
||
| 19 | 2 | $this->eventFactory = $eventFactory; |
|
| 20 | 2 | $this->logger = $logger; |
|
| 21 | } |
||
| 22 | |||
| 23 | 2 | public function build(string $eventNamespace, Response $response): Promise |
|
| 24 | { |
||
| 25 | 2 | return call(function() use ($eventNamespace, $response) { |
|
| 26 | 2 | $results = new Results($this->eventFactory, $this->logger); |
|
| 27 | |||
| 28 | 2 | yield from $results->appendResponse($eventNamespace, $response); |
|
| 29 | |||
| 30 | 2 | return $results; |
|
| 31 | 2 | }); |
|
| 32 | } |
||
| 33 | } |
||
| 34 |