|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* This file is part of the Seams-CMS Delivery SDK package. |
|
7
|
|
|
* |
|
8
|
|
|
* (c) Seams-CMS.com |
|
9
|
|
|
* |
|
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
11
|
|
|
* file that was distributed with this source code. |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
namespace SeamsCMS\Delivery\Model; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Class ContentMeta |
|
18
|
|
|
* @package SeamsCMS\Delivery\Model |
|
19
|
|
|
*/ |
|
20
|
|
|
class ContentMeta |
|
21
|
|
|
{ |
|
22
|
|
|
use HydratorTrait { |
|
23
|
|
|
fromArray as private fromArrayTrait; |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
/** @var string */ |
|
27
|
|
|
private $revisionId = ""; |
|
28
|
|
|
/** @var string */ |
|
29
|
|
|
private $entryId = ""; |
|
30
|
|
|
/** @var string */ |
|
31
|
|
|
private $contentType = ""; |
|
32
|
|
|
/** @var \DateTimeImmutable */ |
|
33
|
|
|
private $createdAt; |
|
34
|
|
|
/** @var string */ |
|
35
|
|
|
private $createdBy = ""; |
|
36
|
|
|
/** @var \DateTimeImmutable */ |
|
37
|
|
|
private $updatedAt; |
|
38
|
|
|
/** @var string */ |
|
39
|
|
|
private $updatedBy = ""; |
|
40
|
|
|
|
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* ContentMeta constructor. |
|
44
|
|
|
* |
|
45
|
|
|
*/ |
|
46
|
6 |
|
final protected function __construct() |
|
47
|
|
|
{ |
|
48
|
6 |
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @return string |
|
52
|
|
|
*/ |
|
53
|
2 |
|
public function getRevisionId(): string |
|
54
|
|
|
{ |
|
55
|
2 |
|
return $this->revisionId; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @return string |
|
60
|
|
|
*/ |
|
61
|
3 |
|
public function getEntryId(): string |
|
62
|
|
|
{ |
|
63
|
3 |
|
return $this->entryId; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @return string |
|
68
|
|
|
*/ |
|
69
|
1 |
|
public function getContentType(): string |
|
70
|
|
|
{ |
|
71
|
1 |
|
return $this->contentType; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @return \DateTimeImmutable |
|
76
|
|
|
*/ |
|
77
|
1 |
|
public function getCreatedAt(): \DateTimeImmutable |
|
78
|
|
|
{ |
|
79
|
1 |
|
return $this->createdAt; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* @return string |
|
84
|
|
|
*/ |
|
85
|
1 |
|
public function getCreatedBy(): string |
|
86
|
|
|
{ |
|
87
|
1 |
|
return $this->createdBy; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* @return \DateTimeImmutable |
|
92
|
|
|
*/ |
|
93
|
1 |
|
public function getUpdatedAt(): \DateTimeImmutable |
|
94
|
|
|
{ |
|
95
|
1 |
|
return $this->updatedAt; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @return string |
|
100
|
|
|
*/ |
|
101
|
1 |
|
public function getUpdatedBy(): string |
|
102
|
|
|
{ |
|
103
|
1 |
|
return $this->updatedBy; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* @param array $data |
|
108
|
|
|
* @return ContentMeta |
|
109
|
|
|
*/ |
|
110
|
6 |
|
public static function fromArray(array $data) |
|
111
|
|
|
{ |
|
112
|
6 |
|
if (isset($data['created_at'])) { |
|
113
|
3 |
|
$data['created_at'] = new \DateTimeImmutable($data['created_at']); |
|
114
|
|
|
} |
|
115
|
6 |
|
if (isset($data['updated_at'])) { |
|
116
|
3 |
|
$data['updated_at'] = new \DateTimeImmutable($data['updated_at']); |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
6 |
|
if (isset($data['type_id'])) { |
|
120
|
|
|
$data['contentType'] = $data['type_id']; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
6 |
|
return self::fromArrayTrait($data); |
|
124
|
|
|
} |
|
125
|
|
|
} |
|
126
|
|
|
|