| Conditions | 6 |
| Paths | 8 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | 3 | public function isEventAlreadyDispatched(string $sagaId, int $sequence, int $index): bool |
|
| 25 | { |
||
| 26 | 3 | $data = $this->sagaPersistence->loadData($sagaId); |
|
| 27 | |||
| 28 | 3 | $lastSequence = $data ? $data['sequence'] : -10000; |
|
| 29 | 3 | $lastIndex = $data ? $data['index'] : -1000; |
|
| 30 | |||
| 31 | 3 | if ($sequence > $lastSequence || ($sequence == $lastSequence && $index > $lastIndex)) { |
|
| 32 | 2 | return false; |
|
| 33 | } |
||
| 34 | |||
| 35 | 1 | return true; |
|
| 36 | } |
||
| 37 | |||
| 52 | } |