Test Setup Failed
Pull Request — master (#46)
by Ekin
06:26
created

Factory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 23
ccs 8
cts 8
cp 1
rs 10
c 1
b 0
f 0
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
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
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