| Total Complexity | 6 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| 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 | public function __construct(array $eventExpressions, ProjectorInterface $projector) |
||
| 20 | { |
||
| 21 | $this->eventExpressions = $eventExpressions; |
||
| 22 | $this->projector = $projector; |
||
| 23 | } |
||
| 24 | |||
| 25 | public function matches(DomainEventInterface $event): bool |
||
| 26 | { |
||
| 27 | $eventFqcn = get_class($event); |
||
| 28 | foreach ($this->eventExpressions as $eventExpression) { |
||
| 29 | if ($eventExpression === $eventFqcn) { |
||
| 30 | return true; |
||
| 31 | } |
||
| 32 | } |
||
| 33 | return false; |
||
| 34 | } |
||
| 35 | |||
| 36 | public function getProjector(): ProjectorInterface |
||
| 37 | { |
||
| 38 | return $this->projector; |
||
| 39 | } |
||
| 40 | |||
| 41 | public function getEventExpressions(): array |
||
| 44 | } |
||
| 45 | } |
||
| 46 |