Conditions | 1 |
Paths | 1 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
66 | public function create($payload) |
||
67 | { |
||
68 | $finalMetaData = new Metadata(); |
||
69 | |||
70 | $finalMetaData = $finalMetaData->merge( |
||
71 | new Metadata( |
||
72 | [ |
||
73 | 'user_id' => $this->userId ?? UUID::generateAsString(), |
||
74 | ] |
||
75 | ) |
||
76 | ); |
||
77 | |||
78 | return new DomainMessage( |
||
79 | $this->id ?? UUID::generateAsString(), |
||
80 | $this->playhead ?? 1, |
||
81 | $finalMetaData, |
||
82 | $payload, |
||
83 | $this->recordedOn ?? DateTime::now() |
||
84 | ); |
||
85 | } |
||
86 | } |
||
87 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: