| Total Complexity | 6 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Coverage | 45.45% |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 7 | final class Envelope |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var string |
||
| 11 | */ |
||
| 12 | private $title; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | private $payload; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var DateTime |
||
| 21 | */ |
||
| 22 | private $timestamp; |
||
| 23 | |||
| 24 | 5 | public function __construct(string $payload, ?string $title = null, ?DateTime $timestamp = null) |
|
| 25 | { |
||
| 26 | 5 | $this->title = $title ?: bin2hex(random_bytes(7)); |
|
| 27 | 5 | $this->timestamp = $timestamp ?: new DateTime(); |
|
| 28 | 5 | $this->payload = $payload; |
|
| 29 | 5 | } |
|
| 30 | |||
| 31 | /** |
||
| 32 | * @return string |
||
| 33 | */ |
||
| 34 | public function getTitle(): string |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @return string |
||
| 41 | */ |
||
| 42 | public function getPayload(): string |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @return DateTime |
||
| 49 | */ |
||
| 50 | public function getTimestamp(): DateTime |
||
| 55 |