1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Superdesk Web Publisher Output Channel Component. |
7
|
|
|
* |
8
|
|
|
* Copyright 2018 Sourcefabric z.ú. and contributors. |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please see the |
11
|
|
|
* AUTHORS and LICENSE files distributed with this source code. |
12
|
|
|
* |
13
|
|
|
* @copyright 2018 Sourcefabric z.ú |
14
|
|
|
* @license http://www.superdesk.org/license |
15
|
|
|
*/ |
16
|
|
|
|
17
|
|
|
namespace SWP\Component\OutputChannel\Model; |
18
|
|
|
|
19
|
|
|
use SWP\Component\Common\Model\SoftDeletableTrait; |
20
|
|
|
use SWP\Component\Common\Model\TimestampableTrait; |
21
|
|
|
|
22
|
|
|
class ExternalArticle implements ExternalArticleInterface |
23
|
|
|
{ |
24
|
|
|
use SoftDeletableTrait, TimestampableTrait; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var int |
28
|
|
|
*/ |
29
|
|
|
protected $id; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var string |
33
|
|
|
*/ |
34
|
|
|
protected $externalId; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var string |
38
|
|
|
*/ |
39
|
|
|
protected $liveUrl; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
protected $status; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var \DateTime |
48
|
|
|
*/ |
49
|
|
|
protected $publishedAt; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var \DateTime |
53
|
|
|
*/ |
54
|
|
|
protected $unpublishedAt; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @var array|null |
58
|
|
|
*/ |
59
|
|
|
protected $extra; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* ExternalArticle constructor. |
63
|
|
|
*/ |
64
|
|
|
public function __construct() |
65
|
|
|
{ |
66
|
|
|
$this->setExtra([]); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* {@inheritdoc} |
71
|
|
|
*/ |
72
|
|
|
public function getId(): int |
73
|
|
|
{ |
74
|
|
|
return $this->id; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* {@inheritdoc} |
79
|
|
|
*/ |
80
|
|
|
public function setId(int $id): void |
81
|
|
|
{ |
82
|
|
|
$this->id = $id; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* {@inheritdoc} |
87
|
|
|
*/ |
88
|
|
|
public function getExternalId(): string |
89
|
|
|
{ |
90
|
|
|
return $this->externalId; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* {@inheritdoc} |
95
|
|
|
*/ |
96
|
|
|
public function setExternalId(string $externalId): void |
97
|
|
|
{ |
98
|
|
|
$this->externalId = $externalId; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* {@inheritdoc} |
103
|
|
|
*/ |
104
|
|
|
public function getLiveUrl(): ?string |
105
|
|
|
{ |
106
|
|
|
return $this->liveUrl; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* {@inheritdoc} |
111
|
|
|
*/ |
112
|
|
|
public function setLiveUrl(string $liveUrl): void |
113
|
|
|
{ |
114
|
|
|
$this->liveUrl = $liveUrl; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* {@inheritdoc} |
119
|
|
|
*/ |
120
|
|
|
public function getStatus(): string |
121
|
|
|
{ |
122
|
|
|
return $this->status; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* {@inheritdoc} |
127
|
|
|
*/ |
128
|
|
|
public function setStatus(string $status): void |
129
|
|
|
{ |
130
|
|
|
$this->status = $status; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* {@inheritdoc} |
135
|
|
|
*/ |
136
|
|
|
public function getPublishedAt(): ?\DateTime |
137
|
|
|
{ |
138
|
|
|
return $this->publishedAt; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* {@inheritdoc} |
143
|
|
|
*/ |
144
|
|
|
public function setPublishedAt(\DateTime $publishedAt): void |
145
|
|
|
{ |
146
|
|
|
$this->publishedAt = $publishedAt; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* {@inheritdoc} |
151
|
|
|
*/ |
152
|
|
|
public function getUnpublishedAt(): ?\DateTime |
153
|
|
|
{ |
154
|
|
|
return $this->unpublishedAt; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* {@inheritdoc} |
159
|
|
|
*/ |
160
|
|
|
public function setUnpublishedAt(\DateTime $unpublishedAt): void |
161
|
|
|
{ |
162
|
|
|
$this->unpublishedAt = $unpublishedAt; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* {@inheritdoc} |
167
|
|
|
*/ |
168
|
|
|
public function getExtra(): ?array |
169
|
|
|
{ |
170
|
|
|
return $this->extra; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* {@inheritdoc} |
175
|
|
|
*/ |
176
|
|
|
public function setExtra(?array $extra): void |
177
|
|
|
{ |
178
|
|
|
$this->extra = $extra; |
179
|
|
|
} |
180
|
|
|
} |
181
|
|
|
|