1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace TreeHouse\IoBundle\Test\Mock; |
4
|
|
|
|
5
|
|
|
use TreeHouse\IoBundle\Entity\Feed; |
6
|
|
|
use TreeHouse\IoBundle\Entity\Scraper; |
7
|
|
|
use TreeHouse\IoBundle\Model\OriginInterface; |
8
|
|
|
use TreeHouse\IoBundle\Model\SourceInterface; |
9
|
|
|
|
10
|
|
|
class SourceMock implements SourceInterface |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @var int |
14
|
|
|
*/ |
15
|
|
|
protected $id; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @var string |
19
|
|
|
*/ |
20
|
|
|
protected $originalId; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
protected $originalUrl; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var bool |
29
|
|
|
*/ |
30
|
|
|
protected $blocked; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var array |
34
|
|
|
*/ |
35
|
|
|
protected $data; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
protected $rawData; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var array |
44
|
|
|
*/ |
45
|
|
|
protected $messages; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var \DateTime |
49
|
|
|
*/ |
50
|
|
|
protected $datetimeLastVisited; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var \DateTime |
54
|
|
|
*/ |
55
|
|
|
protected $datetimeCreated; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var \DateTime |
59
|
|
|
*/ |
60
|
|
|
protected $datetimeModified; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var \DateTime |
64
|
|
|
*/ |
65
|
|
|
protected $datetimeImported; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @var OriginInterface |
69
|
|
|
*/ |
70
|
|
|
protected $origin; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @var Feed |
74
|
|
|
*/ |
75
|
|
|
protected $feed; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @var Scraper |
79
|
|
|
*/ |
80
|
|
|
protected $scraper; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @param int $id |
84
|
|
|
*/ |
85
|
52 |
|
public function __construct($id) |
86
|
|
|
{ |
87
|
52 |
|
$this->id = $id; |
88
|
52 |
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @inheritdoc |
92
|
|
|
*/ |
93
|
12 |
|
public function getId() |
94
|
|
|
{ |
95
|
12 |
|
return $this->id; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @inheritdoc |
100
|
|
|
*/ |
101
|
|
|
public function setOriginalId($originalId) |
102
|
|
|
{ |
103
|
|
|
$this->originalId = $originalId; |
104
|
|
|
|
105
|
|
|
return $this; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @inheritdoc |
110
|
|
|
*/ |
111
|
|
|
public function getOriginalId() |
112
|
|
|
{ |
113
|
|
|
return $this->originalId; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @inheritdoc |
118
|
|
|
*/ |
119
|
|
|
public function setOriginalUrl($originalUrl) |
120
|
|
|
{ |
121
|
|
|
$this->originalUrl = $originalUrl; |
122
|
|
|
|
123
|
|
|
return $this; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @inheritdoc |
128
|
|
|
*/ |
129
|
|
|
public function getOriginalUrl() |
130
|
|
|
{ |
131
|
|
|
return $this->originalUrl; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @inheritdoc |
136
|
|
|
*/ |
137
|
6 |
|
public function setBlocked($blocked) |
138
|
|
|
{ |
139
|
6 |
|
$this->blocked = $blocked; |
140
|
|
|
|
141
|
6 |
|
return $this; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @inheritdoc |
146
|
|
|
*/ |
147
|
20 |
|
public function isBlocked() |
148
|
|
|
{ |
149
|
20 |
|
return $this->blocked; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* @inheritdoc |
154
|
|
|
*/ |
155
|
|
|
public function setData($data) |
156
|
|
|
{ |
157
|
|
|
ksort($data); |
158
|
|
|
|
159
|
|
|
$this->data = $data; |
160
|
|
|
|
161
|
|
|
return $this; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @inheritdoc |
166
|
|
|
*/ |
167
|
|
|
public function getData() |
168
|
|
|
{ |
169
|
|
|
return $this->data; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @inheritdoc |
174
|
|
|
*/ |
175
|
|
|
public function setRawData($data) |
176
|
|
|
{ |
177
|
|
|
$this->rawData = $data; |
178
|
|
|
|
179
|
|
|
return $this; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* @inheritdoc |
184
|
|
|
*/ |
185
|
|
|
public function getRawData() |
186
|
|
|
{ |
187
|
|
|
return $this->rawData; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* @inheritdoc |
192
|
|
|
*/ |
193
|
8 |
|
public function setMessages($messages) |
194
|
|
|
{ |
195
|
8 |
|
$this->messages = $messages; |
196
|
|
|
|
197
|
8 |
|
return $this; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* @inheritdoc |
202
|
|
|
*/ |
203
|
4 |
|
public function getMessages() |
204
|
|
|
{ |
205
|
4 |
|
return $this->messages; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* @inheritdoc |
210
|
|
|
*/ |
211
|
|
|
public function setDatetimeLastVisited(\DateTime $datetimeLastVisited) |
212
|
|
|
{ |
213
|
|
|
$this->datetimeLastVisited = $datetimeLastVisited; |
214
|
|
|
|
215
|
|
|
return $this; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
/** |
219
|
|
|
* @inheritdoc |
220
|
|
|
*/ |
221
|
|
|
public function getDatetimeLastVisited() |
222
|
|
|
{ |
223
|
|
|
return $this->datetimeLastVisited; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* @inheritdoc |
228
|
|
|
*/ |
229
|
|
|
public function setDatetimeCreated(\DateTime $datetimeCreated) |
230
|
|
|
{ |
231
|
|
|
$this->datetimeCreated = $datetimeCreated; |
232
|
|
|
|
233
|
|
|
return $this; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* @inheritdoc |
238
|
|
|
*/ |
239
|
|
|
public function getDatetimeCreated() |
240
|
|
|
{ |
241
|
|
|
return $this->datetimeCreated; |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
/** |
245
|
|
|
* @inheritdoc |
246
|
|
|
*/ |
247
|
|
|
public function setDatetimeModified(\DateTime $datetimeModified) |
248
|
|
|
{ |
249
|
|
|
$this->datetimeModified = $datetimeModified; |
250
|
|
|
|
251
|
|
|
return $this; |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
/** |
255
|
|
|
* @inheritdoc |
256
|
|
|
*/ |
257
|
|
|
public function getDatetimeModified() |
258
|
|
|
{ |
259
|
|
|
return $this->datetimeModified; |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
/** |
263
|
|
|
* Set datetimeImported. |
264
|
|
|
* |
265
|
|
|
* @param \DateTime $datetimeImported |
266
|
|
|
* |
267
|
|
|
* @return $this |
268
|
|
|
*/ |
269
|
6 |
|
public function setDatetimeImported(\DateTime $datetimeImported) |
270
|
|
|
{ |
271
|
6 |
|
$this->datetimeImported = $datetimeImported; |
272
|
6 |
|
return $this; |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* Get datetimeImported. |
277
|
|
|
* |
278
|
|
|
* @return \DateTime |
279
|
|
|
*/ |
280
|
4 |
|
public function getDatetimeImported() |
281
|
|
|
{ |
282
|
4 |
|
return $this->datetimeImported; |
283
|
|
|
} |
284
|
|
|
|
285
|
|
|
/** |
286
|
|
|
* @inheritdoc |
287
|
|
|
*/ |
288
|
|
|
public function setFeed(Feed $feed = null) |
289
|
|
|
{ |
290
|
|
|
$this->feed = $feed; |
291
|
|
|
|
292
|
|
|
return $this; |
293
|
|
|
} |
294
|
|
|
|
295
|
|
|
/** |
296
|
|
|
* @inheritdoc |
297
|
|
|
*/ |
298
|
|
|
public function getFeed() |
299
|
|
|
{ |
300
|
|
|
return $this->feed; |
301
|
|
|
} |
302
|
|
|
|
303
|
|
|
/** |
304
|
|
|
* @inheritdoc |
305
|
|
|
*/ |
306
|
|
|
public function setScraper(Scraper $scraper = null) |
307
|
|
|
{ |
308
|
|
|
$this->scraper = $scraper; |
309
|
|
|
|
310
|
|
|
return $this; |
311
|
|
|
} |
312
|
|
|
|
313
|
|
|
/** |
314
|
|
|
* @inheritdoc |
315
|
|
|
*/ |
316
|
|
|
public function getScraper() |
317
|
|
|
{ |
318
|
|
|
return $this->scraper; |
319
|
|
|
} |
320
|
|
|
|
321
|
|
|
/** |
322
|
|
|
* @inheritdoc |
323
|
|
|
*/ |
324
|
|
|
public function getOrigin() |
325
|
|
|
{ |
326
|
|
|
return $this->feed->getOrigin(); |
327
|
|
|
} |
328
|
|
|
} |
329
|
|
|
|