| Conditions | 6 |
| Paths | 10 |
| Total Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | 3 | public function invoke($context, callable $next) |
|
| 16 | { |
||
| 17 | 3 | $correlationId = null; |
|
| 18 | |||
| 19 | 3 | if ($context->getIncomingPhysicalMessage()) { |
|
| 20 | 2 | $incomingHeaders = $context->getIncomingPhysicalMessage()->getHeaders(); |
|
| 21 | |||
| 22 | 2 | if (isset($incomingHeaders[HeaderTypeEnum::CORRELATION_ID])) { |
|
| 23 | 1 | $correlationId = $incomingHeaders[HeaderTypeEnum::CORRELATION_ID]; |
|
| 24 | } |
||
| 25 | |||
| 26 | 2 | if (!$correlationId && isset($incomingHeaders[HeaderTypeEnum::MESSAGE_ID])) { |
|
| 27 | 1 | $correlationId = $incomingHeaders[HeaderTypeEnum::MESSAGE_ID]; |
|
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | 3 | if (!$correlationId) { |
|
| 32 | 1 | $correlationId = $context->getMessageId(); |
|
| 33 | } |
||
| 34 | |||
| 35 | 3 | $context->setHeader(HeaderTypeEnum::CORRELATION_ID, $correlationId); |
|
| 36 | |||
| 37 | 3 | $next(); |
|
| 38 | 3 | } |
|
| 39 | |||
| 48 |