MessageEntity::setTopicId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 0
cts 5
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Comrade42\PhpBBParser\Entity\SimpleMachines;
4
5
use Comrade42\PhpBBParser\Entity\PostInterface;
6
7
/**
8
 * Class Messages
9
 * @package Comrade42\PhpBBParser\Entity\SimpleMachines
10
 * @Entity
11
 * @Table(
12
 *     name="messages",
13
 *     uniqueConstraints={
14
 *         @UniqueConstraint(name="topic", columns={"id_topic", "id_msg"}),
15
 *         @UniqueConstraint(name="id_board", columns={"id_board", "id_msg"}),
16
 *         @UniqueConstraint(name="id_member", columns={"id_member", "id_msg"})
17
 *     },
18
 *     indexes={
19
 *         @Index(name="approved", columns={"approved"}),
20
 *         @Index(name="ip_index", columns={"poster_ip", "id_topic"}),
21
 *         @Index(name="participation", columns={"id_member", "id_topic"}),
22
 *         @Index(name="show_posts", columns={"id_member", "id_board"}),
23
 *         @Index(name="id_topic", columns={"id_topic"}),
24
 *         @Index(name="id_member_msg", columns={"id_member", "approved", "id_msg"}),
25
 *         @Index(name="current_topic", columns={"id_topic", "id_msg", "id_member", "approved"}),
26
 *         @Index(name="related_ip", columns={"id_member", "poster_ip", "id_msg"})
27
 *     }
28
 * )
29
 */
30
class MessageEntity implements PostInterface
31
{
32
    /**
33
     * @var integer
34
     *
35
     * @Column(name="id_msg", type="integer", nullable=false)
36
     * @Id
37
     */
38
    private $idMsg;
39
40
    /**
41
     * @var integer
42
     *
43
     * @Column(name="id_topic", type="integer", nullable=false)
44
     */
45
    private $idTopic = 0;
46
47
    /**
48
     * @var integer
49
     *
50
     * @Column(name="id_board", type="smallint", nullable=false)
51
     */
52
    private $idBoard = 0;
53
54
    /**
55
     * @var integer
56
     *
57
     * @Column(name="poster_time", type="integer", nullable=false)
58
     */
59
    private $posterTime = 0;
60
61
    /**
62
     * @var integer
63
     *
64
     * @Column(name="id_member", type="integer", nullable=false)
65
     */
66
    private $idMember = 0;
67
68
    /**
69
     * @var integer
70
     *
71
     * @Column(name="id_msg_modified", type="integer", nullable=false)
72
     */
73
    private $idMsgModified = 0;
0 ignored issues
show
Unused Code introduced by
The property $idMsgModified is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
74
75
    /**
76
     * @var string
77
     *
78
     * @Column(name="subject", type="string", length=255, nullable=false)
79
     */
80
    private $subject = '';
81
82
    /**
83
     * @var string
84
     *
85
     * @Column(name="poster_name", type="string", length=255, nullable=false)
86
     */
87
    private $posterName = '';
88
89
    /**
90
     * @var string
91
     *
92
     * @Column(name="poster_email", type="string", length=255, nullable=false)
93
     */
94
    private $posterEmail = '';
0 ignored issues
show
Unused Code introduced by
The property $posterEmail is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
95
96
    /**
97
     * @var string
98
     *
99
     * @Column(name="poster_ip", type="string", length=255, nullable=false)
100
     */
101
    private $posterIp = '';
0 ignored issues
show
Unused Code introduced by
The property $posterIp is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
102
103
    /**
104
     * @var boolean
105
     *
106
     * @Column(name="smileys_enabled", type="boolean", nullable=false)
107
     */
108
    private $smileysEnabled = 1;
0 ignored issues
show
Unused Code introduced by
The property $smileysEnabled is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
109
110
    /**
111
     * @var integer
112
     *
113
     * @Column(name="modified_time", type="integer", nullable=false)
114
     */
115
    private $modifiedTime = 0;
0 ignored issues
show
Unused Code introduced by
The property $modifiedTime is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
116
117
    /**
118
     * @var string
119
     *
120
     * @Column(name="modified_name", type="string", length=255, nullable=false)
121
     */
122
    private $modifiedName = '';
0 ignored issues
show
Unused Code introduced by
The property $modifiedName is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
123
124
    /**
125
     * @var string
126
     *
127
     * @Column(name="body", type="text", nullable=false)
128
     */
129
    private $body;
130
131
    /**
132
     * @var string
133
     *
134
     * @Column(name="icon", type="string", length=16, nullable=false)
135
     */
136
    private $icon = 'xx';
0 ignored issues
show
Unused Code introduced by
The property $icon is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
137
138
    /**
139
     * @var boolean
140
     *
141
     * @Column(name="approved", type="boolean", nullable=false)
142
     */
143
    private $approved = '1';
0 ignored issues
show
Unused Code introduced by
The property $approved is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
144
145
    /**
146
     * @return int
147
     */
148
    public function getId()
149
    {
150
        return $this->idMsg;
151
    }
152
153
    /**
154
     * @param int $id
155
     * @return MessageEntity
156
     */
157
    public function setId($id)
158
    {
159
        $this->idMsg = intval($id);
160
161
        return $this;
162
    }
163
164
    /**
165
     * @param int $id
166
     * @return MessageEntity
167
     */
168
    public function setForumId($id)
169
    {
170
        $this->idBoard = intval($id);
171
172
        return $this;
173
    }
174
175
    /**
176
     * @param int $id
177
     * @return MessageEntity
178
     */
179
    public function setTopicId($id)
180
    {
181
        $this->idTopic = intval($id);
182
183
        return $this;
184
    }
185
186
    /**
187
     * @param int $id
188
     * @return MessageEntity
189
     */
190
    public function setAuthorId($id)
191
    {
192
        $this->idMember = intval($id);
193
194
        return $this;
195
    }
196
197
    /**
198
     * @param string $name
199
     * @return MessageEntity
200
     */
201
    public function setAuthorName($name)
202
    {
203
        $this->posterName = strval($name);
204
205
        return $this;
206
    }
207
208
    /**
209
     * @param \DateTime $dateTime
210
     * @return MessageEntity
211
     */
212
    public function setCreateDate(\DateTime $dateTime)
213
    {
214
        $this->posterTime = $dateTime->getTimestamp();
215
216
        return $this;
217
    }
218
219
    /**
220
     * @param string $subject
221
     * @return MessageEntity
222
     */
223
    public function setSubject($subject)
224
    {
225
        $this->subject = strval($subject);
226
227
        return $this;
228
    }
229
230
    /**
231
     * @param string $content
232
     * @return MessageEntity
233
     */
234
    public function setContent($content)
235
    {
236
        $this->body = strval($content);
237
238
        return $this;
239
    }
240
}
241