ekinhbayar /
gitamp
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php declare(strict_types=1); |
||
| 2 | |||
| 3 | namespace ekinhbayar\GitAmp\Response; |
||
| 4 | |||
| 5 | use Amp\Promise; |
||
| 6 | use ekinhbayar\GitAmp\Event\Factory as EventFactory; |
||
| 7 | use Amp\Http\Client\Response; |
||
| 8 | use Psr\Log\LoggerInterface; |
||
| 9 | use function Amp\call; |
||
| 10 | |||
| 11 | class Factory |
||
| 12 | { |
||
| 13 | private EventFactory $eventFactory; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 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 |