Total Complexity | 6 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Coverage | 78.56% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
13 | final class EventProjector implements EventProjectorInterface |
||
14 | { |
||
15 | private array $eventExpressions; |
||
16 | |||
17 | private ProjectorInterface $projector; |
||
18 | |||
19 | 1 | public function __construct(array $eventExpressions, ProjectorInterface $projector) |
|
20 | { |
||
21 | 1 | $this->eventExpressions = $eventExpressions; |
|
22 | 1 | $this->projector = $projector; |
|
23 | 1 | } |
|
24 | |||
25 | 1 | public function matches(DomainEventInterface $event): bool |
|
26 | { |
||
27 | 1 | $eventFqcn = get_class($event); |
|
28 | 1 | foreach ($this->eventExpressions as $eventExpression) { |
|
29 | 1 | if ($eventExpression === $eventFqcn) { |
|
30 | 1 | return true; |
|
31 | } |
||
32 | } |
||
33 | return false; |
||
34 | } |
||
35 | |||
36 | 1 | public function getProjector(): ProjectorInterface |
|
37 | { |
||
38 | 1 | return $this->projector; |
|
39 | } |
||
40 | |||
41 | public function getEventExpressions(): array |
||
44 | } |
||
45 | } |
||
46 |