Lines
66.66%
2 / 3
Functions and Methods
66.66%
2 / 3
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| RequestFailed | 66.66% | 2 / 3 | 66.66% | 2 / 3 | 3.33 | 0.00% | 0 / 1 | |||
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| fromException | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| getOutboxDelivery | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Runtime\Ipc\Message; | |
| 6 | ||
| 7 | use Stewart\Contracts\Exception\ExceptionReason; | |
| 8 | use Stewart\Contracts\Exception\StewartException; | |
| 9 | use Stewart\Runtime\Model\CorrelationId; | |
| 10 | use Stewart\Runtime\Model\ExceptionDetails; | |
| 11 | ||
| 12 | #[IpcMessage(tag: 'request_failed')] | |
| 13 | final readonly class RequestFailed implements BrokerMessage | |
| 14 | { | |
| 15 | public function __construct( | |
| 16 | public CorrelationId $correlationId, | |
| 17 | public string $message, | |
| 18 | public ExceptionDetails $details, | |
| 19 | ) {} | |
| 20 | ||
| 21 | /** @param StewartException<ExceptionReason> $failure */ | |
| 22 | public static function fromException(CorrelationId $correlationId, StewartException $failure): self | |
| 23 | { | |
| 24 | return new self($correlationId, $failure->getMessage(), ExceptionDetails::fromException($failure)); | |
| 25 | } | |
| 26 | ||
| 27 | public function getOutboxDelivery(): OutboxDelivery | |
| 28 | { | |
| 29 | return OutboxDelivery::Plain; | |
| 30 | } | |
| 31 | } |