| Total Complexity | 7 |
| Total Lines | 62 |
| Duplicated Lines | 0 % |
| Coverage | 44.44% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class ScheduledMessage |
||
| 11 | { |
||
| 12 | public const STATE_PENDING = 'pending'; |
||
| 13 | |||
| 14 | public const STATE_DISPATCHED = 'dispatched'; |
||
| 15 | |||
| 16 | public const STATE_PROCESSING = 'processing'; |
||
| 17 | |||
| 18 | public const STATE_FAILED = 'failed'; |
||
| 19 | |||
| 20 | public const STATE_SUCCESSFUL = 'successful'; |
||
| 21 | |||
| 22 | protected string $id; |
||
| 23 | |||
| 24 | protected string $serializedMessage; |
||
| 25 | |||
| 26 | protected DateTimeInterface $dispatchAt; |
||
| 27 | |||
| 28 | protected ?string $bus; |
||
| 29 | |||
| 30 | protected string $state = self::STATE_PENDING; |
||
| 31 | |||
| 32 | protected array $errors = []; |
||
| 33 | |||
| 34 | protected ?int $version = null; |
||
| 35 | |||
| 36 | 1 | public function __construct(string $serializedMessage, DateTimeInterface $dispatchAt, string $bus = null) |
|
| 37 | { |
||
| 38 | 1 | $this->id = (string) Uuid::uuid4(); |
|
| 39 | 1 | $this->serializedMessage = $serializedMessage; |
|
| 40 | 1 | $this->dispatchAt = $dispatchAt; |
|
| 41 | 1 | $this->bus = $bus; |
|
| 42 | 1 | } |
|
| 43 | |||
| 44 | 1 | public function getId(): string |
|
| 45 | { |
||
| 46 | 1 | return $this->id; |
|
| 47 | } |
||
| 48 | |||
| 49 | public function getSerializedMessage(): string |
||
| 50 | { |
||
| 51 | return $this->serializedMessage; |
||
| 52 | } |
||
| 53 | |||
| 54 | public function getDispatchAt(): DateTimeInterface |
||
| 55 | { |
||
| 56 | return $this->dispatchAt; |
||
| 57 | } |
||
| 58 | |||
| 59 | public function getBus(): ?string |
||
| 60 | { |
||
| 61 | return $this->bus; |
||
| 62 | } |
||
| 63 | |||
| 64 | public function getState(): string |
||
| 67 | } |
||
| 68 | |||
| 69 | public function addError(string $error): void |
||
| 72 | } |
||
| 73 | } |
||
| 74 |