Topic::getCommentsCount()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace PhpEarth\Stats\Model;
4
5
/**
6
 * Class Topic.
7
 */
8
class Topic
9
{
10
    /**
11
     * @var int Topic id.
12
     */
13
    private $id;
14
15
    /**
16
     * @var User Topic's author.
17
     */
18
    private $user;
19
20
    /**
21
     * @var string
22
     */
23
    private $createdTime;
24
25
    /**
26
     * @var int
27
     */
28
    private $reactionsCount = 0;
29
30
    /**
31
     * @var int
32
     */
33
    private $commentsCount = 0;
34
35
    /**
36
     * @var string
37
     */
38
    private $message = '';
39
40
    /**
41
     * @var bool
42
     */
43
    private $canComment = true;
44
45
    /**
46
     * @var string
47
     */
48
    private $type;
49
50
    /**
51
     * @var int
52
     */
53
    private $sharesCount = 0;
54
55
    /**
56
     * Set topic id.
57
     *
58
     * @param $id
59
     */
60
    public function setId($id)
61
    {
62
        $this->id = $id;
63
    }
64
65
    /**
66
     * Get topic id.
67
     *
68
     * @return mixed
69
     */
70
    public function getId()
71
    {
72
        return $this->id;
73
    }
74
75
    /**
76
     * Set the topic's author.
77
     *
78
     * @param User $user
79
     */
80
    public function setUser(User $user)
81
    {
82
        $this->user = $user;
83
    }
84
85
    /**
86
     * Get topic author.
87
     *
88
     * @return User
89
     */
90
    public function getUser()
91
    {
92
        return $this->user;
93
    }
94
95
    /**
96
     * Set created time of the topic.
97
     *
98
     * @param string $createdTime
99
     */
100
    public function setCreatedTime($createdTime)
101
    {
102
        $this->createdTime = $createdTime;
103
    }
104
105
    /**
106
     * Get created time of the topic.
107
     *
108
     * @return string
109
     */
110
    public function getCreatedTime()
111
    {
112
        return $this->createdTime;
113
    }
114
115
    /**
116
     * Set number of topic reactions.
117
     *
118
     * @param int $reactionsCount
119
     */
120
    public function setReactionsCount($reactionsCount)
121
    {
122
        $this->reactionsCount = $reactionsCount;
123
    }
124
125
    /**
126
     * Get number of topic reactions.
127
     *
128
     * @return int
129
     */
130
    public function getReactionsCount()
131
    {
132
        return $this->reactionsCount;
133
    }
134
135
    /**
136
     * Set topic's number of comments and replies.
137
     *
138
     * @param int $commentsCount
139
     */
140
    public function setCommentsCount($commentsCount)
141
    {
142
        $this->commentsCount = $commentsCount;
143
    }
144
145
    /**
146
     * Get topic's number of comments and replies.
147
     *
148
     * @return int
149
     */
150
    public function getCommentsCount()
151
    {
152
        return $this->commentsCount;
153
    }
154
155
    /**
156
     * Set topic's message.
157
     *
158
     * @param string $message
159
     */
160
    public function setMessage($message)
161
    {
162
        $this->message = $message;
163
    }
164
165
    /**
166
     * Get topic's message.
167
     *
168
     * @return string
169
     */
170
    public function getMessage()
171
    {
172
        return $this->message;
173
    }
174
175
    /**
176
     * Set the boolean value whether the commenting is turned off or not.
177
     *
178
     * @param bool $canComment
179
     */
180
    public function setCanComment($canComment)
181
    {
182
        $this->canComment = $canComment;
183
    }
184
185
    /**
186
     * Get post type.
187
     *
188
     * @return string
189
     */
190
    public function getType()
191
    {
192
        return $this->type;
193
    }
194
195
    /**
196
     * Set the topic type (photo, status, animated_image_share...)
197
     *
198
     * @param string $type
199
     */
200
    public function setType($type)
201
    {
202
        $this->type = $type;
203
    }
204
205
    /**
206
     * Get boolean value whether topic has comments turned off or not.
207
     *
208
     * @return bool
209
     */
210
    public function getCanComment()
211
    {
212
        return $this->canComment;
213
    }
214
215
    /**
216
     * Unique Facebook post ID in groups has format {group_id}_{topic_id}.
217
     * Returns only the last part of the topic ID that is needed for permalink URL.
218
     *
219
     * @return int
220
     */
221
    public function getPermalinkPostId()
222
    {
223
        return substr($this->getId(), strpos($this->getId(), '_') + 1);
0 ignored issues
show
Bug Best Practice introduced by
The expression return substr($this->get...his->getId(), '_') + 1) returns the type string which is incompatible with the documented return type integer.
Loading history...
224
    }
225
226
    /**
227
     * Set topic's number of shares.
228
     *
229
     * @param int $sharesCount
230
     */
231
    public function setSharesCount($sharesCount)
232
    {
233
        $this->sharesCount = $sharesCount;
234
    }
235
236
    /**
237
     * Get topic's number of shares.
238
     *
239
     * @return int
240
     */
241
    public function getSharesCount()
242
    {
243
        return $this->sharesCount;
244
    }
245
}
246