Passed
Push — master ( c22b6a...5f79f5 )
by Julito
11:21
created

MeetingActivity::getEventDecoded()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
c 0
b 0
f 0
nc 2
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\PluginBundle\Zoom;
6
7
use DateTime;
8
use Doctrine\ORM\Mapping as ORM;
9
10
/**
11
 * Class Meeting.
12
 *
13
 * @ORM\Entity()
14
 * @ORM\Table(name="plugin_zoom_meeting_activity")
15
 * @ORM\HasLifecycleCallbacks
16
 */
17
class MeetingActivity
18
{
19
    /**
20
     * @var int
21
     * @ORM\Column(type="integer")
22
     * @ORM\Id
23
     * @ORM\GeneratedValue()
24
     */
25
    protected $id;
26
27
    /**
28
     * @var Meeting
29
     *
30
     * @ORM\ManyToOne(targetEntity="Meeting", inversedBy="activities")
31
     * @ORM\JoinColumn(name="meeting_id")
32
     */
33
    protected $meeting;
34
35
    /**
36
     * @var Meeting
37
     *
38
     * @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User")
39
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
40
     */
41
    protected $user;
42
43
    /**
44
     * @var string
45
     *
46
     * @ORM\Column(type="string", name="name", length=255, nullable=false)
47
     */
48
    protected $name;
49
50
    /**
51
     * @var string
52
     *
53
     * @ORM\Column(type="string", name="type", length=255, nullable=false)
54
     */
55
    protected $type;
56
57
    /**
58
     * @var string
59
     *
60
     * @ORM\Column(type="text", name="event", nullable=true)
61
     */
62
    protected $event;
63
64
    /**
65
     * @var \DateTime
66
     *
67
     * @ORM\Column(name="created_at", type="datetime", nullable=false)
68
     */
69
    protected $createdAt;
70
71
    public function __construct()
72
    {
73
        $this->createdAt = new \DateTime();
74
    }
75
76
    /**
77
     * @return string
78
     */
79
    public function __toString()
80
    {
81
        return sprintf('Activity %d', $this->id);
82
    }
83
84
    /**
85
     * @return int
86
     */
87
    public function getId()
88
    {
89
        return $this->id;
90
    }
91
92
    /**
93
     * @return Meeting
94
     */
95
    public function getMeeting()
96
    {
97
        return $this->meeting;
98
    }
99
100
    /**
101
     * @param Meeting $meeting
102
     *
103
     * @return MeetingActivity
104
     */
105
    public function setMeeting($meeting)
106
    {
107
        $this->meeting = $meeting;
108
109
        return $this;
110
    }
111
112
    /**
113
     * @return string
114
     */
115
    public function getName()
116
    {
117
        return $this->name;
118
    }
119
120
    /**
121
     * @param string $name
122
     *
123
     * @return MeetingActivity
124
     */
125
    public function setName($name)
126
    {
127
        $this->name = $name;
128
129
        return $this;
130
    }
131
132
    /**
133
     * @return string
134
     */
135
    public function getType()
136
    {
137
        return $this->type;
138
    }
139
140
    /**
141
     * @param string $type
142
     *
143
     * @return MeetingActivity
144
     */
145
    public function setType($type)
146
    {
147
        $this->type = $type;
148
149
        return $this;
150
    }
151
152
    /**
153
     * @return DateTime
154
     */
155
    public function getCreatedAt()
156
    {
157
        return $this->createdAt;
158
    }
159
160
    /**
161
     * @return string
162
     */
163
    public function getEvent()
164
    {
165
        return $this->event;
166
    }
167
168
    /**
169
     * @return Meeting
170
     */
171
    public function getUser()
172
    {
173
        return $this->user;
174
    }
175
176
    /**
177
     * @param Meeting $user
178
     *
179
     * @return MeetingActivity
180
     */
181
    public function setUser($user)
182
    {
183
        $this->user = $user;
184
185
        return $this;
186
    }
187
188
    public function getEventDecoded()
189
    {
190
        if (!empty($this->event)) {
191
            return json_decode($this->event);
192
        }
193
194
        return '';
195
    }
196
197
    /**
198
     * @param string $event
199
     *
200
     * @return MeetingActivity
201
     */
202
    public function setEvent($event)
203
    {
204
        $this->event = $event;
205
206
        return $this;
207
    }
208
}
209