|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright (c) 2016-2016} Andreas Heigl<[email protected]> |
|
4
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|
5
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
|
6
|
|
|
* in the Software without restriction, including without limitation the rights |
|
7
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
8
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
|
9
|
|
|
* furnished to do so, subject to the following conditions: |
|
10
|
|
|
* The above copyright notice and this permission notice shall be included in |
|
11
|
|
|
* all copies or substantial portions of the Software. |
|
12
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
13
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
14
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
15
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
16
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
17
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
18
|
|
|
* THE SOFTWARE. |
|
19
|
|
|
* |
|
20
|
|
|
* @author Andreas Heigl<[email protected]> |
|
21
|
|
|
* @copyright 2016-2016 Andreas Heigl |
|
22
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php MIT-License |
|
23
|
|
|
* @version 0.0 |
|
24
|
|
|
* @since 16.01.2016 |
|
25
|
|
|
* @link http://github.com/heiglandreas/callingallpapers |
|
26
|
|
|
*/ |
|
27
|
|
|
|
|
28
|
|
|
namespace Callingallpapers\Api\Entity; |
|
29
|
|
|
|
|
30
|
|
|
class Cfp |
|
31
|
|
|
{ |
|
32
|
|
|
/** |
|
33
|
|
|
* @var string The URI for the CfP. This is the unique identifier for |
|
34
|
|
|
* different CfPs. |
|
35
|
|
|
*/ |
|
36
|
|
|
protected $uri = ''; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @var string The name of the event this CfP belongs to |
|
40
|
|
|
*/ |
|
41
|
|
|
protected $name = ''; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var \DateTimeInterface The start-date of the CfP |
|
45
|
|
|
*/ |
|
46
|
|
|
protected $dateCfpStart; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @var \DateTimeInterface The end date of the CfP |
|
50
|
|
|
*/ |
|
51
|
|
|
protected $dateCfpEnd; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @var string The Name of the venue |
|
55
|
|
|
*/ |
|
56
|
|
|
protected $location; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @var float The latitude of the venue |
|
60
|
|
|
*/ |
|
61
|
|
|
protected $latitude; |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @var float The longitude of the venue |
|
65
|
|
|
*/ |
|
66
|
|
|
protected $longitude; |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @var string The description of the Event |
|
70
|
|
|
*/ |
|
71
|
|
|
protected $description; |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @var \DateTimeImmutable The date the event starts at |
|
75
|
|
|
*/ |
|
76
|
|
|
protected $dateEventStart; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @var \DateTimeImmutable The date the event ends at |
|
80
|
|
|
*/ |
|
81
|
|
|
protected $dateEventEnd; |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @var string the URI of an icon of the Event |
|
85
|
|
|
*/ |
|
86
|
|
|
protected $iconUri; |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @var string The URI of the events-site |
|
90
|
|
|
*/ |
|
91
|
|
|
protected $eventUri; |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* @var \DateTimeZone The Timezone of the CFP-Dates |
|
95
|
|
|
*/ |
|
96
|
|
|
protected $timezone; |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @var array the tags of the CfP resp. the Event |
|
100
|
|
|
*/ |
|
101
|
|
|
protected $tags = []; |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* @var \DateTimeInterface Date of the last change |
|
105
|
|
|
*/ |
|
106
|
|
|
protected $lastUpdate = null; |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* @var array The sources of a CfP |
|
110
|
|
|
*/ |
|
111
|
|
|
protected $source = []; |
|
112
|
|
|
|
|
113
|
|
|
public function __construct() |
|
114
|
|
|
{ |
|
115
|
|
|
$this->dateCfpStart = new \DateTimeImmutable(); |
|
116
|
|
|
$this->dateCfpEnd = new \DateTimeImmutable(); |
|
117
|
|
|
$this->dateEventStart = new \DateTimeImmutable(); |
|
118
|
|
|
$this->dateEventEnd = new \DateTimeImmutable(); |
|
119
|
|
|
$this->timezone = new \DateTimezone('UTC'); |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
public function setUri($uri) |
|
123
|
|
|
{ |
|
124
|
|
|
$this->uri = $uri; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
public function getUri() |
|
128
|
|
|
{ |
|
129
|
|
|
return $this->uri; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
public function setName($name) |
|
133
|
|
|
{ |
|
134
|
|
|
$this->name = $name; |
|
135
|
|
|
} |
|
136
|
|
|
|
|
137
|
|
|
public function getName() |
|
138
|
|
|
{ |
|
139
|
|
|
return $this->name; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
public function setDateCfpStart(\DateTimeInterface $startDate) |
|
143
|
|
|
{ |
|
144
|
|
|
$this->dateCfpStart = $startDate; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
public function getDateCfpStart() |
|
148
|
|
|
{ |
|
149
|
|
|
return $this->dateCfpStart; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
public function setDateCfpEnd(\DateTimeInterface $endDate) |
|
153
|
|
|
{ |
|
154
|
|
|
$this->dateCfpEnd = $endDate; |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
public function getDateCfpEnd() |
|
158
|
|
|
{ |
|
159
|
|
|
return $this->dateCfpEnd; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
public function getId() |
|
163
|
|
|
{ |
|
164
|
|
|
return $this->getHash(); |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
public function setLocation($location) |
|
168
|
|
|
{ |
|
169
|
|
|
$this->location = $location; |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
public function getLocation() |
|
173
|
|
|
{ |
|
174
|
|
|
return $this->location; |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
public function setLongitude($longitude) |
|
178
|
|
|
{ |
|
179
|
|
|
$this->longitude = $longitude; |
|
180
|
|
|
} |
|
181
|
|
|
|
|
182
|
|
|
public function getLongitude() |
|
183
|
|
|
{ |
|
184
|
|
|
return $this->longitude; |
|
185
|
|
|
} |
|
186
|
|
|
|
|
187
|
|
|
public function setLatitude($latitude) |
|
188
|
|
|
{ |
|
189
|
|
|
$this->latitude = $latitude; |
|
190
|
|
|
} |
|
191
|
|
|
|
|
192
|
|
|
public function getLatitude() |
|
193
|
|
|
{ |
|
194
|
|
|
return $this->latitude; |
|
195
|
|
|
} |
|
196
|
|
|
|
|
197
|
|
|
public function setDescription($description) |
|
198
|
|
|
{ |
|
199
|
|
|
$this->description = $description; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
public function getDescription() |
|
203
|
|
|
{ |
|
204
|
|
|
return $this->description; |
|
205
|
|
|
} |
|
206
|
|
|
|
|
207
|
|
|
public function setDateEventStart(\DateTimeInterface $startDate) |
|
208
|
|
|
{ |
|
209
|
|
|
$this->dateEventStart = $startDate; |
|
|
|
|
|
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
public function getDateEventStart() |
|
213
|
|
|
{ |
|
214
|
|
|
return $this->dateEventStart; |
|
215
|
|
|
} |
|
216
|
|
|
|
|
217
|
|
|
public function setDateEventEnd(\DateTimeInterface $endDate) |
|
218
|
|
|
{ |
|
219
|
|
|
$this->dateEventEnd = $endDate; |
|
|
|
|
|
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
public function getDateEventEnd() |
|
223
|
|
|
{ |
|
224
|
|
|
return $this->dateEventEnd; |
|
225
|
|
|
} |
|
226
|
|
|
|
|
227
|
|
|
public function setIconUri($iconUri) |
|
228
|
|
|
{ |
|
229
|
|
|
$this->iconUri = $iconUri; |
|
230
|
|
|
} |
|
231
|
|
|
|
|
232
|
|
|
public function getIconUri() |
|
233
|
|
|
{ |
|
234
|
|
|
return $this->iconUri; |
|
235
|
|
|
} |
|
236
|
|
|
|
|
237
|
|
|
public function setEventUri($eventUri) |
|
238
|
|
|
{ |
|
239
|
|
|
$this->eventUri = $eventUri; |
|
240
|
|
|
} |
|
241
|
|
|
|
|
242
|
|
|
public function getEventUri() |
|
243
|
|
|
{ |
|
244
|
|
|
return $this->eventUri; |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
public function setTimezone($timezone) |
|
248
|
|
|
{ |
|
249
|
|
|
if (! $timezone instanceof \DateTimeZone) { |
|
250
|
|
|
$timezone = new \DateTimeZone($timezone); |
|
251
|
|
|
} |
|
252
|
|
|
|
|
253
|
|
|
$this->timezone = $timezone; |
|
254
|
|
|
} |
|
255
|
|
|
|
|
256
|
|
|
public function getTimezone() |
|
257
|
|
|
{ |
|
258
|
|
|
return $this->timezone; |
|
259
|
|
|
} |
|
260
|
|
|
|
|
261
|
|
|
public function getHash() |
|
262
|
|
|
{ |
|
263
|
|
|
return sha1($this->getEventUri()); |
|
264
|
|
|
} |
|
265
|
|
|
|
|
266
|
|
|
public function setTags(array $tags) |
|
267
|
|
|
{ |
|
268
|
|
|
$this->tags = $tags; |
|
269
|
|
|
} |
|
270
|
|
|
|
|
271
|
|
|
public function getTags() |
|
272
|
|
|
{ |
|
273
|
|
|
return $this->tags; |
|
274
|
|
|
} |
|
275
|
|
|
|
|
276
|
|
|
public function getLastUdated() |
|
277
|
|
|
{ |
|
278
|
|
|
return $this->lastUpdate; |
|
279
|
|
|
} |
|
280
|
|
|
|
|
281
|
|
|
public function setLastUpdated(\DateTimeinterface $date) |
|
282
|
|
|
{ |
|
283
|
|
|
$this->lastUpdate = $date; |
|
284
|
|
|
} |
|
285
|
|
|
|
|
286
|
|
|
public function setSource(array $source) |
|
287
|
|
|
{ |
|
288
|
|
|
$this->source = $source; |
|
289
|
|
|
} |
|
290
|
|
|
|
|
291
|
|
|
public function getSource() |
|
292
|
|
|
{ |
|
293
|
|
|
return $this->source; |
|
294
|
|
|
} |
|
295
|
|
|
|
|
296
|
|
|
public function addSource($source) |
|
297
|
|
|
{ |
|
298
|
|
|
if (! in_array($source)) { |
|
299
|
|
|
$this->source[] = $source; |
|
300
|
|
|
} |
|
301
|
|
|
} |
|
302
|
|
|
} |
|
303
|
|
|
|
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.