CalendarEvent::getFilters()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Toiba\FullCalendarBundle\Event;
4
5
use Symfony\Component\EventDispatcher\Event as EventDispatcher;
6
use Toiba\FullCalendarBundle\Entity\Event;
7
8
class CalendarEvent extends EventDispatcher
9
{
10
    const SET_DATA = 'fullcalendar.set_data';
11
12
    /**
13
     * @var \DateTimeInterface
14
     */
15
    protected $start;
16
17
    /**
18
     * @var \DateTimeInterface
19
     */
20
    protected $end;
21
22
    /**
23
     * @var array
24
     */
25
    protected $filters;
26
27
    /**
28
     * @var Event[]
29
     */
30
    protected $events = [];
31
32
    /**
33
     * @param \DateTimeInterface $start
34
     * @param \DateTimeInterface $end
35
     * @param array              $filters
36
     */
37 1
    public function __construct(
38
        \DateTimeInterface $start,
39
        \DateTimeInterface $end,
40
        array $filters
41
    ) {
42 1
        $this->start = $start;
43 1
        $this->end = $end;
44 1
        $this->filters = $filters;
45 1
    }
46
47
    /**
48
     * @return \DateTimeInterface
49
     */
50
    public function getStart(): \DateTimeInterface
51
    {
52
        return $this->start;
53
    }
54
55
    /**
56
     * @return \DateTimeInterface
57
     */
58
    public function getEnd(): \DateTimeInterface
59
    {
60
        return $this->end;
61
    }
62
63
    /**
64
     * @return array
65
     */
66
    public function getFilters(): array
67
    {
68
        return $this->filters;
69
    }
70
71
    /**
72
     * @param Event $event
73
     *
74
     * @return $this
75
     */
76
    public function addEvent(Event $event): self
77
    {
78
        if (!in_array($event, $this->events, true)) {
79
            $this->events[] = $event;
80
        }
81
82
        return $this;
83
    }
84
85
    /**
86
     * @return Event[]
87
     */
88
    public function getEvents(): array
89
    {
90
        return $this->events;
91
    }
92
}
93