BoardEntity::setOrder()   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\ForumInterface;
6
7
/**
8
 * Class BoardEntity
9
 * @package Comrade42\PhpBBParser\Entity\SimpleMachines
10
 * @Entity
11
 * @Table(
12
 *     name="boards",
13
 *     uniqueConstraints={
14
 *         @UniqueConstraint(name="categories", columns={"id_cat", "id_board"})
15
 *     },
16
 *     indexes={
17
 *         @Index(name="id_parent", columns={"id_parent"}),
18
 *         @Index(name="id_msg_updated", columns={"id_msg_updated"}),
19
 *         @Index(name="member_groups", columns={"member_groups"})
20
 *     }
21
 * )
22
 */
23
class BoardEntity implements ForumInterface
24
{
25
    /**
26
     * @var integer
27
     *
28
     * @Column(name="id_board", type="smallint", nullable=false)
29
     * @Id
30
     */
31
    public $idBoard;
32
33
    /**
34
     * @var integer
35
     *
36
     * @Column(name="id_cat", type="smallint", nullable=false)
37
     */
38
    public $idCat = 0;
39
40
    /**
41
     * @var integer
42
     *
43
     * @Column(name="child_level", type="smallint", nullable=false)
44
     */
45
    public $childLevel = 0;
46
47
    /**
48
     * @var integer
49
     *
50
     * @Column(name="id_parent", type="smallint", nullable=false)
51
     */
52
    public $idParent = 0;
53
54
    /**
55
     * @var integer
56
     *
57
     * @Column(name="board_order", type="smallint", nullable=false)
58
     */
59
    public $boardOrder = 0;
60
61
    /**
62
     * @var integer
63
     *
64
     * @Column(name="id_last_msg", type="integer", nullable=false)
65
     */
66
    public $idLastMsg = 0;
67
68
    /**
69
     * @var integer
70
     *
71
     * @Column(name="id_msg_updated", type="integer", nullable=false)
72
     */
73
    public $idMsgUpdated = 0;
74
75
    /**
76
     * @var string
77
     *
78
     * @Column(name="member_groups", type="string", length=255, nullable=false)
79
     */
80
    public $memberGroups = '-1,0';
81
82
    /**
83
     * @var integer
84
     *
85
     * @Column(name="id_profile", type="smallint", nullable=false)
86
     */
87
    public $idProfile = 1;
88
89
    /**
90
     * @var string
91
     *
92
     * @Column(name="name", type="string", length=255, nullable=false)
93
     */
94
    public $name = '';
95
96
    /**
97
     * @var string
98
     *
99
     * @Column(name="description", type="text", nullable=false)
100
     */
101
    public $description;
102
103
    /**
104
     * @var integer
105
     *
106
     * @Column(name="num_topics", type="integer", nullable=false)
107
     */
108
    public $numTopics = 0;
109
110
    /**
111
     * @var integer
112
     *
113
     * @Column(name="num_posts", type="integer", nullable=false)
114
     */
115
    public $numPosts = 0;
116
117
    /**
118
     * @var integer
119
     *
120
     * @Column(name="count_posts", type="smallint", nullable=false)
121
     */
122
    public $countPosts = 0;
123
124
    /**
125
     * @var integer
126
     *
127
     * @Column(name="id_theme", type="smallint", nullable=false)
128
     */
129
    public $idTheme = 0;
130
131
    /**
132
     * @var integer
133
     *
134
     * @Column(name="override_theme", type="smallint", nullable=false)
135
     */
136
    public $overrideTheme = 0;
137
138
    /**
139
     * @var integer
140
     *
141
     * @Column(name="unapproved_posts", type="smallint", nullable=false)
142
     */
143
    public $unapprovedPosts = 0;
144
145
    /**
146
     * @var integer
147
     *
148
     * @Column(name="unapproved_topics", type="smallint", nullable=false)
149
     */
150
    public $unapprovedTopics = 0;
151
152
    /**
153
     * @var string
154
     *
155
     * @Column(name="redirect", type="string", length=255, nullable=false)
156
     */
157
    public $redirect = '';
158
159
    /**
160
     * @return int
161
     */
162
    public function getId()
163
    {
164
        return $this->idBoard;
165
    }
166
167
    /**
168
     * @param int $id
169
     * @return BoardEntity
170
     */
171
    public function setId($id)
172
    {
173
        $this->idBoard = intval($id);
174
175
        return $this;
176
    }
177
178
    /**
179
     * @param int $id
180
     * @return BoardEntity
181
     */
182
    public function setCategoryId($id)
183
    {
184
        $this->idCat = intval($id);
185
186
        return $this;
187
    }
188
189
    /**
190
     * @return string
191
     */
192
    public function getTitle()
193
    {
194
        return $this->name;
195
    }
196
197
    /**
198
     * @param string $title
199
     * @return BoardEntity
200
     */
201
    public function setTitle($title)
202
    {
203
        $this->name = strval($title);
204
205
        return $this;
206
    }
207
208
    /**
209
     * @param string $description
210
     * @return BoardEntity
211
     */
212
    public function setDescription($description)
213
    {
214
        $this->description = strval($description);
215
216
        return $this;
217
    }
218
219
    /**
220
     * @param int $order
221
     * @return BoardEntity
222
     */
223
    public function setOrder($order)
224
    {
225
        $this->boardOrder = intval($order);
226
227
        return $this;
228
    }
229
230
    /**
231
     * @param int $categoryId
232
     * @param string $title
233
     * @param string $description
234
     * @param int $order
235
     * @return $this
236
     */
237
    public function fill($categoryId, $title, $description, $order)
238
    {
239
        $this->idCat = intval($categoryId);
240
        $this->name = strval($title);
241
        $this->description = strval($description);
242
        $this->boardOrder = intval($order);
243
244
        return $this;
245
    }
246
}
247