summaryrefslogtreecommitdiff
path: root/src/Helpers/Schedule/Event.php
blob: 46970e7bae70de2d3548baebfde8b7162d0ce3d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
<?php

declare(strict_types=1);

namespace Engelsystem\Helpers\Schedule;

use Carbon\Carbon;

class Event
{
    use CalculatesTime;

    /** @var string required globally unique */
    protected $guid;

    /** @var int required globally unique */
    protected $id;

    /** @var Room required, string in XML */
    protected $room;

    /** @var string required */
    protected $title;

    /** @var string required */
    protected $subtitle;

    /** @var string required */
    protected $type;

    /** @var Carbon required */
    protected $date;

    /** @var string required time (hh:mm:ss || hh:mm) */
    protected $start;

    /** @var string required (h?h:mm:ss || h?h:mm) */
    protected $duration;

    /** @var string required */
    protected $abstract;

    /** @var string required globally unique */
    protected $slug;

    /** @var string required */
    protected $track;

    /** @var string|null */
    protected $logo;

    /** @var string[] id => name */
    protected $persons;

    /** @var string|null two letter code */
    protected $language;

    /** @var string|null */
    protected $description;

    /** @var string|null license (and opt out in XML, null if not recorded, empty if no license defined) */
    protected $recording;

    /** @var array href => title */
    protected $links;

    /** @var array href => name */
    protected $attachments;

    /** @var string|null */
    protected $url;

    /** @var string|null */
    protected $videoDownloadUrl;

    /** @var Carbon Calculated */
    protected $endDate;

    /**
     * Event constructor.
     *
     * @param string      $guid
     * @param int         $id
     * @param Room        $room
     * @param string      $title
     * @param string      $subtitle
     * @param string      $type
     * @param Carbon      $date
     * @param string      $start
     * @param string      $duration
     * @param string      $abstract
     * @param string      $slug
     * @param string      $track
     * @param string|null $logo
     * @param string[]    $persons
     * @param string|null $language
     * @param string|null $description
     * @param string|null $recording license
     * @param array       $links
     * @param array       $attachments
     * @param string|null $url
     * @param string|null $videoDownloadUrl
     */
    public function __construct(
        string $guid,
        int $id,
        Room $room,
        string $title,
        string $subtitle,
        string $type,
        Carbon $date,
        string $start,
        string $duration,
        string $abstract,
        string $slug,
        string $track,
        ?string $logo = null,
        array $persons = [],
        ?string $language = null,
        ?string $description = null,
        string $recording = '',
        array $links = [],
        array $attachments = [],
        ?string $url = null,
        ?string $videoDownloadUrl = null
    ) {
        $this->guid = $guid;
        $this->id = $id;
        $this->room = $room;
        $this->title = $title;
        $this->subtitle = $subtitle;
        $this->type = $type;
        $this->date = $date;
        $this->start = $start;
        $this->duration = $duration;
        $this->abstract = $abstract;
        $this->slug = $slug;
        $this->track = $track;
        $this->logo = $logo;
        $this->persons = $persons;
        $this->language = $language;
        $this->description = $description;
        $this->recording = $recording;
        $this->links = $links;
        $this->attachments = $attachments;
        $this->url = $url;
        $this->videoDownloadUrl = $videoDownloadUrl;

        $this->endDate = $this->date
            ->copy()
            ->addSeconds($this->getDurationSeconds());
    }

    /**
     * @return string
     */
    public function getGuid(): string
    {
        return $this->guid;
    }

    /**
     * @return int
     */
    public function getId(): int
    {
        return $this->id;
    }

    /**
     * @return Room
     */
    public function getRoom(): Room
    {
        return $this->room;
    }

    /**
     * @return string
     */
    public function getTitle(): string
    {
        return $this->title;
    }

    /**
     * @return string
     */
    public function getSubtitle(): string
    {
        return $this->subtitle;
    }

    /**
     * @return string
     */
    public function getType(): string
    {
        return $this->type;
    }

    /**
     * @return Carbon
     */
    public function getDate(): Carbon
    {
        return $this->date;
    }

    /**
     * @return string
     */
    public function getStart(): string
    {
        return $this->start;
    }

    /**
     * @return string
     */
    public function getDuration(): string
    {
        return $this->duration;
    }

    /**
     * @return int
     */
    public function getDurationSeconds(): int
    {
        return $this->secondsFromTime($this->duration);
    }

    /**
     * @return string
     */
    public function getAbstract(): string
    {
        return $this->abstract;
    }

    /**
     * @return string
     */
    public function getSlug(): string
    {
        return $this->slug;
    }

    /**
     * @return string
     */
    public function getTrack(): string
    {
        return $this->track;
    }

    /**
     * @return string|null
     */
    public function getLogo(): ?string
    {
        return $this->logo;
    }

    /**
     * @return string[]
     */
    public function getPersons(): array
    {
        return $this->persons;
    }

    /**
     * @return string|null
     */
    public function getLanguage(): ?string
    {
        return $this->language;
    }

    /**
     * @return string|null
     */
    public function getDescription(): ?string
    {
        return $this->description;
    }

    /**
     * @return string|null
     */
    public function getRecording(): ?string
    {
        return $this->recording;
    }

    /**
     * @return array
     */
    public function getLinks(): array
    {
        return $this->links;
    }

    /**
     * @return array
     */
    public function getAttachments(): array
    {
        return $this->attachments;
    }

    /**
     * @return string|null
     */
    public function getUrl(): ?string
    {
        return $this->url;
    }

    /**
     * @return string|null
     */
    public function getVideoDownloadUrl(): ?string
    {
        return $this->videoDownloadUrl;
    }

    /**
     * @return Carbon
     */
    public function getEndDate(): Carbon
    {
        return $this->endDate;
    }
}