| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function handle(EnvelopeInterface $envelope): bool |
||
| 21 | { |
||
| 22 | $commit = $envelope->getMessage(); |
||
| 23 | Assertion::implementsInterface($commit, CommitInterface::class); |
||
| 24 | |||
| 25 | foreach ($commit->getEventLog() as $domainEvent) { |
||
| 26 | $aggregatePrefix = AggregatePrefix::fromFqcn($domainEvent->getAggregateRootClass()); |
||
| 27 | $projectors = $this->projectorMap->filterByAggregatePrefix($aggregatePrefix); |
||
| 28 | foreach ($projectors->getIterator() as $projector) { |
||
| 29 | if (!$projector->handle($envelope)) { |
||
| 30 | throw new DbalException('Projector %s failed to handle message.'); |
||
| 31 | } |
||
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 35 | return true; |
||
| 36 | } |
||
| 37 | } |
||
| 38 |