1 | <?php |
||
21 | class DomainMessage implements DomainMessageInterface |
||
22 | { |
||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private $id; |
||
27 | |||
28 | /** |
||
29 | * @var int |
||
30 | */ |
||
31 | private $version; |
||
32 | |||
33 | /** |
||
34 | * @var DateTime |
||
35 | */ |
||
36 | private $created; |
||
37 | |||
38 | /** |
||
39 | * @var DomainEventInterface |
||
40 | */ |
||
41 | private $payload; |
||
42 | |||
43 | /** |
||
44 | * Constructor. |
||
45 | * |
||
46 | * @param mixed $id |
||
47 | * @param int $version |
||
48 | * @param DateTime $created |
||
49 | * @param DomainEventInterface $payload |
||
50 | */ |
||
51 | public function __construct($id, $version, DateTime $created, DomainEventInterface $payload) |
||
52 | { |
||
53 | $this->id = $id; |
||
54 | $this->version = $version; |
||
55 | $this->created = $created; |
||
56 | $this->payload = $payload; |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * Factory create domain message. |
||
61 | * |
||
62 | * @param IdentifierInterface $id |
||
63 | * @param int $version |
||
64 | * @param DomainEventInterface $payload |
||
65 | * |
||
66 | * @return static |
||
67 | */ |
||
68 | public static function create(IdentifierInterface $id, $version, DomainEventInterface $payload) |
||
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | public function getId() |
||
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | */ |
||
84 | public function getVersion() |
||
88 | |||
89 | /** |
||
90 | * {@inheritdoc} |
||
91 | */ |
||
92 | public function getType() |
||
96 | |||
97 | /** |
||
98 | * {@inheritdoc} |
||
99 | */ |
||
100 | public function getCreated() |
||
104 | |||
105 | /** |
||
106 | * {@inheritdoc} |
||
107 | */ |
||
108 | public function getPayload() |
||
112 | } |
||
113 |