Total Complexity | 6 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | final class BookCreated implements JsonSerializable |
||
13 | { |
||
14 | private $bookId; |
||
15 | private $authorId; |
||
16 | private $title; |
||
17 | private $occurredOn; |
||
18 | |||
19 | public function __construct(BookId $bookId, AuthorId $authorId, string $title, DateTimeInterface $occurredOn) |
||
20 | { |
||
21 | $this->bookId = (string) $bookId; |
||
22 | $this->authorId = (string) $authorId; |
||
23 | $this->title = $title; |
||
24 | $this->occurredOn = $occurredOn; |
||
25 | } |
||
26 | |||
27 | public function bookId(): BookId |
||
28 | { |
||
29 | return BookId::fromString($this->bookId); |
||
30 | } |
||
31 | |||
32 | public function authorId(): AuthorId |
||
33 | { |
||
34 | return AuthorId::fromString($this->authorId); |
||
35 | } |
||
36 | |||
37 | public function title(): string |
||
38 | { |
||
39 | return $this->title; |
||
40 | } |
||
41 | |||
42 | public function occurredOn(): DateTimeInterface |
||
43 | { |
||
44 | return $this->occurredOn; |
||
45 | } |
||
46 | |||
47 | public function jsonSerialize(): array |
||
48 | { |
||
49 | return get_object_vars($this); |
||
50 | } |
||
52 |