Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
72.97% covered (warning)
72.97%
27 / 37
94.74% covered (success)
94.74%
18 / 19
CRAP
0.00% covered (danger)
0.00%
0 / 1
Comment
72.97% covered (warning)
72.97%
27 / 37
94.74% covered (success)
94.74%
18 / 19
26.13
0.00% covered (danger)
0.00%
0 / 1
 getId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setId
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getRecordId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setRecordId
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getCategoryId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setCategoryId
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getType
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setType
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getUsername
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setUsername
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getEmail
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setEmail
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getComment
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setComment
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getDate
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setDate
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 hasHelped
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setHelped
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 jsonSerialize
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 * The Comment class.
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public License,
7 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
8 * obtain one at https://mozilla.org/MPL/2.0/.
9 *
10 * @package   phpMyFAQ\Entity
11 * @author    Thorsten Rinne <thorsten@phpmyfaq.de>
12 * @copyright 2019-2026 phpMyFAQ Team
13 * @license   https://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
14 * @link      https://www.phpmyfaq.de
15 * @since     2019-12-28
16 */
17
18declare(strict_types=1);
19
20namespace phpMyFAQ\Entity;
21
22/**
23 * Class Comment
24 * @package phpMyFAQ\Entity
25 */
26class Comment implements \JsonSerializable
27{
28    public int $id;
29
30    public int $recordId;
31
32    public int $categoryId;
33
34    public string $type;
35
36    public string $username;
37
38    public string $email;
39
40    public string $comment;
41
42    public string $date;
43
44    public ?bool $helped = null;
45
46    public function getId(): int
47    {
48        return $this->id;
49    }
50
51    public function setId(int $id): Comment
52    {
53        $this->id = $id;
54        return $this;
55    }
56
57    public function getRecordId(): int
58    {
59        return $this->recordId;
60    }
61
62    public function setRecordId(int $recordId): Comment
63    {
64        $this->recordId = $recordId;
65        return $this;
66    }
67
68    public function getCategoryId(): int
69    {
70        return $this->categoryId;
71    }
72
73    public function setCategoryId(int $categoryId): Comment
74    {
75        $this->categoryId = $categoryId;
76        return $this;
77    }
78
79    public function getType(): string
80    {
81        return $this->type;
82    }
83
84    public function setType(string $type): Comment
85    {
86        $this->type = $type;
87        return $this;
88    }
89
90    public function getUsername(): string
91    {
92        return $this->username;
93    }
94
95    public function setUsername(string $username): Comment
96    {
97        $this->username = $username;
98        return $this;
99    }
100
101    public function getEmail(): string
102    {
103        return $this->email;
104    }
105
106    public function setEmail(string $email): Comment
107    {
108        $this->email = $email;
109        return $this;
110    }
111
112    public function getComment(): string
113    {
114        return $this->comment;
115    }
116
117    public function setComment(string $comment): Comment
118    {
119        $this->comment = $comment;
120        return $this;
121    }
122
123    public function getDate(): string
124    {
125        return $this->date;
126    }
127
128    public function setDate(string $date): Comment
129    {
130        $this->date = $date;
131        return $this;
132    }
133
134    public function hasHelped(): ?bool
135    {
136        return $this->helped;
137    }
138
139    public function setHelped(bool $helped): Comment
140    {
141        $this->helped = $helped;
142        return $this;
143    }
144
145    public function jsonSerialize(): array
146    {
147        return [
148            'id' => $this->id,
149            'recordId' => $this->recordId,
150            'categoryId' => $this->categoryId ?? null,
151            'type' => $this->type,
152            'username' => $this->username,
153            'comment' => $this->comment,
154            'date' => $this->date,
155            'helped' => $this->helped,
156        ];
157    }
158}