Completed
Pull Request — master (#475)
by
unknown
02:00
created

Configuration::setImportId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * Configuration for time options.
5
 */
6
declare(strict_types=1);
7
8
namespace HDNET\Calendarize\Domain\Model;
9
10
use HDNET\Autoloader\Annotation\DatabaseField;
11
use HDNET\Autoloader\Annotation\DatabaseTable;
12
use HDNET\Autoloader\Annotation\SmartExclude;
13
use HDNET\Calendarize\Utility\DateTimeUtility;
14
15
/**
16
 * Configuration for time options.
17
 *
18
 * @DatabaseTable
19
 * @SmartExclude(excludes={"Language"})
20
 */
21
class Configuration extends AbstractModel implements ConfigurationInterface
22
{
23
    /**
24
     * Type.
25
     *
26
     * @var string
27
     * @DatabaseField("string")
28
     */
29
    protected $type = self::TYPE_TIME;
30
31
    /**
32
     * Handling.
33
     *
34
     * @var string
35
     * @DatabaseField("string")
36
     */
37
    protected $handling = self::HANDLING_INCLUDE;
38
39
    /**
40
     * State.
41
     *
42
     * @var string
43
     * @DatabaseField("string")
44
     */
45
    protected $state = self::STATE_DEFAULT;
46
47
    /**
48
     * Start date.
49
     *
50
     * @var \DateTime
51
     * @DatabaseField(type="\DateTime", sql="date default NULL")
52
     */
53
    protected $startDate;
54
55
    /**
56
     * End date.
57
     *
58
     * @var \DateTime
59
     * @DatabaseField(type="\DateTime", sql="date default NULL")
60
     */
61
    protected $endDate;
62
63
    /**
64
     * End date dynamic.
65
     *
66
     * @var string
67
     * @DatabaseField("string")
68
     */
69
    protected $endDateDynamic;
70
71
    /**
72
     * Start time.
73
     *
74
     * @var int
75
     * @DatabaseField("int")
76
     */
77
    protected $startTime;
78
79
    /**
80
     * End time.
81
     *
82
     * @var int
83
     * @DatabaseField("int")
84
     */
85
    protected $endTime;
86
87
    /**
88
     * AllDay.
89
     *
90
     * @var bool
91
     * @DatabaseField("bool")
92
     */
93
    protected $allDay;
94
95
    /**
96
     * OpenEndTime.
97
     *
98
     * @var bool
99
     * @DatabaseField("bool")
100
     */
101
    protected $openEndTime;
102
103
    /**
104
     * External ICS url.
105
     *
106
     * @var string
107
     * @DatabaseField("string")
108
     */
109
    protected $externalIcsUrl;
110
111
    /**
112
     * Groups.
113
     *
114
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\HDNET\Calendarize\Domain\Model\ConfigurationGroup>
115
     * @DatabaseField("\TYPO3\CMS\Extbase\Persistence\ObjectStorage")
116
     * @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
117
     */
118
    protected $groups;
119
120
    /**
121
     * Frequency.
122
     *
123
     * @var string
124
     * @DatabaseField("string")
125
     */
126
    protected $frequency = self::FREQUENCY_NONE;
127
128
    /**
129
     * Till date.
130
     *
131
     * @var \DateTime
132
     * @DatabaseField("\DateTime")
133
     */
134
    protected $tillDate;
135
136
    /**
137
     * Till days.
138
     *
139
     * @var int
140
     * @DatabaseField(sql="int(11)")
141
     */
142
    protected $tillDays;
143
144
    /**
145
     * Till days relative.
146
     *
147
     * @var bool
148
     * @DatabaseField("Boolean")
149
     */
150
    protected $tillDaysRelative;
151
152
    /**
153
     * Till days past.
154
     *
155
     * @var int
156
     * @DatabaseField(sql="int(11)")
157
     */
158
    protected $tillDaysPast;
159
160
    /**
161
     * Counter amount.
162
     *
163
     * @var int
164
     * @DatabaseField("int")
165
     */
166
    protected $counterAmount;
167
168
    /**
169
     * Counter interval.
170
     *
171
     * @var int
172
     * @DatabaseField("int")
173
     */
174
    protected $counterInterval;
175
176
    /**
177
     * Recurrence.
178
     *
179
     * @var string
180
     * @DatabaseField("string")
181
     */
182
    protected $recurrence = self::RECURRENCE_NONE;
183
184
    /**
185
     * Day property.
186
     *
187
     * @var string
188
     * @DatabaseField("string")
189
     */
190
    protected $day = self::DAY_NONE;
191
192
    /**
193
     * Import ID if the item is based on an ICS structure.
194
     *
195
     * @var string|null
196
     * @DatabaseField("string")
197
     */
198
    protected $importId;
199
200
    /**
201
     * Configuration constructor.
202
     */
203
    public function __construct()
204
    {
205
        $this->groups = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
206
    }
207
208
    /**
209
     * Get type.
210
     *
211
     * @return string
212
     */
213
    public function getType()
214
    {
215
        return $this->type;
216
    }
217
218
    /**
219
     * Set type.
220
     *
221
     * @param string $type
222
     */
223
    public function setType($type)
224
    {
225
        $this->type = $type;
226
    }
227
228
    /**
229
     * Is all day.
230
     *
231
     * @return bool
232
     */
233
    public function isAllDay()
234
    {
235
        return (bool)$this->allDay;
236
    }
237
238
    /**
239
     * Set all day.
240
     *
241
     * @param bool $allDay
242
     */
243
    public function setAllDay($allDay)
244
    {
245
        $this->allDay = (bool)$allDay;
246
    }
247
248
    /**
249
     * Get end date.
250
     *
251
     * @return \DateTime
252
     */
253
    public function getEndDate()
254
    {
255
        if ($this->endDate instanceof \DateTime) {
256
            $this->endDate->setTimezone(DateTimeUtility::getTimeZone());
257
        }
258
259
        return $this->endDate;
260
    }
261
262
    /**
263
     * Set end date.
264
     *
265
     * @param \DateTime $endDate
266
     */
267
    public function setEndDate($endDate)
268
    {
269
        $this->endDate = $endDate;
270
    }
271
272
    /**
273
     * Get end date dynamic.
274
     *
275
     * @return string
276
     */
277
    public function getEndDateDynamic()
278
    {
279
        return $this->endDateDynamic;
280
    }
281
282
    /**
283
     * Set end date dynamic.
284
     *
285
     * @param string $endDateDynamic
286
     */
287
    public function setEndDateDynamic($endDateDynamic)
288
    {
289
        $this->endDateDynamic = $endDateDynamic;
290
    }
291
292
    /**
293
     * Get end time.
294
     *
295
     * @return int
296
     */
297
    public function getEndTime()
298
    {
299
        return $this->endTime;
300
    }
301
302
    /**
303
     * Set end time.
304
     *
305
     * @param int $endTime
306
     */
307
    public function setEndTime($endTime)
308
    {
309
        $this->endTime = $endTime;
310
    }
311
312
    /**
313
     * Get start date.
314
     *
315
     * @return \DateTime
316
     */
317
    public function getStartDate()
318
    {
319
        if ($this->startDate instanceof \DateTime) {
320
            $this->startDate->setTimezone(DateTimeUtility::getTimeZone());
321
        }
322
323
        return $this->startDate;
324
    }
325
326
    /**
327
     * Set start date.
328
     *
329
     * @param \DateTime $startDate
330
     */
331
    public function setStartDate($startDate)
332
    {
333
        $this->startDate = $startDate;
334
    }
335
336
    /**
337
     * Get start time.
338
     *
339
     * @return int
340
     */
341
    public function getStartTime()
342
    {
343
        return $this->startTime;
344
    }
345
346
    /**
347
     * Set start time.
348
     *
349
     * @param int $startTime
350
     */
351
    public function setStartTime($startTime)
352
    {
353
        $this->startTime = $startTime;
354
    }
355
356
    /**
357
     * Get groups.
358
     *
359
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
360
     */
361
    public function getGroups()
362
    {
363
        if (null === $this->groups) {
364
            return new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
365
        }
366
367
        return $this->groups;
368
    }
369
370
    /**
371
     * Set groups.
372
     *
373
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $groups
374
     */
375
    public function setGroups($groups)
376
    {
377
        $this->groups = $groups;
378
    }
379
380
    /**
381
     * Get frequency.
382
     *
383
     * @return string
384
     */
385
    public function getFrequency()
386
    {
387
        return $this->frequency;
388
    }
389
390
    /**
391
     * Set frequency.
392
     *
393
     * @param string $frequency
394
     */
395
    public function setFrequency($frequency)
396
    {
397
        $this->frequency = $frequency;
398
    }
399
400
    /**
401
     * Get till date.
402
     *
403
     * @return \DateTime
404
     */
405
    public function getTillDate()
406
    {
407
        return $this->tillDate;
408
    }
409
410
    /**
411
     * Set till date.
412
     *
413
     * @param \DateTime $tillDate
414
     */
415
    public function setTillDate($tillDate)
416
    {
417
        $this->tillDate = $tillDate;
418
    }
419
420
    /**
421
     * Get till days.
422
     *
423
     * @return int
424
     */
425
    public function getTillDays()
426
    {
427
        return $this->tillDays;
428
    }
429
430
    /**
431
     * Set till days.
432
     *
433
     * @param int $tillDays
434
     */
435
    public function setTillDays(int $tillDays)
436
    {
437
        $this->tillDays = $tillDays;
438
    }
439
440
    /**
441
     * Is till days relative.
442
     *
443
     * @return bool
444
     */
445
    public function isTillDaysRelative()
446
    {
447
        return $this->tillDaysRelative;
448
    }
449
450
    /**
451
     * Set till days relative.
452
     *
453
     * @param bool $tillDaysRelative
454
     */
455
    public function setTillDaysRelative(bool $tillDaysRelative)
456
    {
457
        $this->tillDaysRelative = $tillDaysRelative;
458
    }
459
460
    /**
461
     * Get till days past.
462
     *
463
     * @return int
464
     */
465
    public function getTillDaysPast()
466
    {
467
        return $this->tillDaysPast;
468
    }
469
470
    /**
471
     * Set till days past.
472
     *
473
     * @param int $tillDaysPast
474
     */
475
    public function setTillDaysPast(int $tillDaysPast)
476
    {
477
        $this->tillDaysPast = $tillDaysPast;
478
    }
479
480
    /**
481
     * Get counter amount.
482
     *
483
     * @return int
484
     */
485
    public function getCounterAmount()
486
    {
487
        return $this->counterAmount;
488
    }
489
490
    /**
491
     * Set counter amount.
492
     *
493
     * @param int $counterAmount
494
     */
495
    public function setCounterAmount($counterAmount)
496
    {
497
        $this->counterAmount = $counterAmount;
498
    }
499
500
    /**
501
     * Get counter interval.
502
     *
503
     * @return int
504
     */
505
    public function getCounterInterval()
506
    {
507
        return $this->counterInterval;
508
    }
509
510
    /**
511
     * Set counter interval.
512
     *
513
     * @param int $counterInterval
514
     */
515
    public function setCounterInterval($counterInterval)
516
    {
517
        $this->counterInterval = $counterInterval;
518
    }
519
520
    /**
521
     * Get external ICS URL.
522
     *
523
     * @return string
524
     */
525
    public function getExternalIcsUrl()
526
    {
527
        return $this->externalIcsUrl;
528
    }
529
530
    /**
531
     * Set external ICS URL.
532
     *
533
     * @param string $externalIcsUrl
534
     */
535
    public function setExternalIcsUrl($externalIcsUrl)
536
    {
537
        $this->externalIcsUrl = $externalIcsUrl;
538
    }
539
540
    /**
541
     * Get day.
542
     *
543
     * @return string
544
     */
545
    public function getDay()
546
    {
547
        return $this->day;
548
    }
549
550
    /**
551
     * Set day.
552
     *
553
     * @param string $day
554
     */
555
    public function setDay($day)
556
    {
557
        $this->day = $day;
558
    }
559
560
    /**
561
     * Get recurrence.
562
     *
563
     * @return string
564
     */
565
    public function getRecurrence()
566
    {
567
        return $this->recurrence;
568
    }
569
570
    /**
571
     * Set recurrence.
572
     *
573
     * @param string $recurrence
574
     */
575
    public function setRecurrence($recurrence)
576
    {
577
        $this->recurrence = $recurrence;
578
    }
579
580
    /**
581
     * Get handling.
582
     *
583
     * @return string
584
     */
585
    public function getHandling()
586
    {
587
        return $this->handling;
588
    }
589
590
    /**
591
     * Set handling.
592
     *
593
     * @param string $handling
594
     */
595
    public function setHandling($handling)
596
    {
597
        $this->handling = $handling;
598
    }
599
600
    /**
601
     * Get state.
602
     *
603
     * @return string
604
     */
605
    public function getState()
606
    {
607
        return trim($this->state);
608
    }
609
610
    /**
611
     * Set state.
612
     *
613
     * @param string $state
614
     */
615
    public function setState($state)
616
    {
617
        $this->state = $state;
618
    }
619
620
    /**
621
     * @return bool
622
     */
623
    public function isOpenEndTime()
624
    {
625
        return (bool)$this->openEndTime;
626
    }
627
628
    /**
629
     * @param bool $openEndTime
630
     */
631
    public function setOpenEndTime(bool $openEndTime)
632
    {
633
        $this->openEndTime = $openEndTime;
634
    }
635
636
    /**
637
     * @return string|null
638
     */
639
    public function getImportId(): ?string
640
    {
641
        return $this->importId;
642
    }
643
644
    /**
645
     * @param string|null $importId
646
     */
647
    public function setImportId(?string $importId): void
648
    {
649
        $this->importId = $importId;
650
    }
651
}
652