| Conditions | 3 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | 3 | public function deliver(MessageInterface $message, callable $next): void |
|
| 25 | { |
||
| 26 | 3 | if ($this->entityManager->getConnection()->isTransactionActive()) { |
|
| 27 | 2 | $next($message); |
|
| 28 | |||
| 29 | 1 | return; |
|
| 30 | } |
||
| 31 | |||
| 32 | try { |
||
| 33 | 3 | $this->entityManager->beginTransaction(); |
|
| 34 | 3 | $next($message); |
|
| 35 | 2 | $this->entityManager->flush(); |
|
| 36 | 2 | $this->entityManager->commit(); |
|
| 37 | 1 | } catch (Exception $exception) { |
|
| 38 | 1 | $this->entityManager->rollback(); |
|
| 39 | 1 | throw $exception; |
|
| 40 | } |
||
| 43 |