• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

fnagel / t3extblog / 23823603081

31 Mar 2026 11:05PM UTC coverage: 37.437% (-12.6%) from 50.045%
23823603081

push

github

fnagel
[FEATURE] Add YAML lint to composer scripts and CI

Using the new TYPO3 14.2 built in YAML linter.

https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.3/Feature-104973-ActivateLintYamlExecutableForTYPO3.html

1256 of 3355 relevant lines covered (37.44%)

3.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

76.47
/Classes/Domain/Model/Comment.php
1
<?php
2

3
namespace FelixNagel\T3extblog\Domain\Model;
4

5
/**
6
 * This file is part of the "t3extblog" Extension for TYPO3 CMS.
7
 *
8
 * For the full copyright and license information, please read the
9
 * LICENSE.txt file that was distributed with this source code.
10
 */
11

12
use FelixNagel\T3extblog\Validation\Validator\UrlValidator;
13
use TYPO3\CMS\Extbase\Annotation\ORM\Lazy;
14
use TYPO3\CMS\Extbase\Annotation as Extbase;
15

16
/**
17
 * Comment.
18
 *
19
 * @SuppressWarnings("PHPMD.TooManyFields")
20
 */
21
class Comment extends AbstractEntity
22
{
23
    #[Extbase\Validate(['validator' => 'Text'])]
24
    protected ?string $title = null;
25

26
    #[Extbase\Validate(['validator' => 'NotEmpty'])]
27
    #[Extbase\Validate(['validator' => 'Text'])]
28
    protected ?string $author = null;
29

30
    #[Extbase\Validate(['validator' => 'EmailAddress'])]
31
    protected ?string $email = null;
32

33
    #[Extbase\Validate(['validator' => UrlValidator::class])]
34
    protected ?string $website = null;
35

36
    protected ?\DateTime $date = null;
37

38
    #[Extbase\Validate(['validator' => 'NotEmpty'])]
39
    protected ?string $text = null;
40

41
    protected bool $approved = false;
42

43
    protected bool $spam = false;
44

45
    protected ?int $spamPoints = null;
46

47
    protected ?int $postId = null;
48

49
    #[Lazy]
50
    protected ?Post $post = null;
51

52
    /**
53
     * subscribe (not persisted).
54
     */
55
    protected bool $subscribe = false;
56

57
    /**
58
     * If the notification mails are already sent.
59
     */
60
    protected bool $mailsSent = false;
61

62
    protected bool $privacyPolicyAccepted = false;
63

64
    public function __construct()
27✔
65
    {
66
        $this->date = new \DateTime();
27✔
67
    }
68

69
    public function getTitle(): ?string
13✔
70
    {
71
        return $this->title;
13✔
72
    }
73

74
    public function setTitle(?string $title): void
×
75
    {
76
        $this->title = $title;
×
77
    }
78

79
    public function getAuthor(): ?string
13✔
80
    {
81
        return $this->author;
13✔
82
    }
83

84
    public function setAuthor(?string $author): void
7✔
85
    {
86
        $this->author = $author;
7✔
87
    }
88

89
    public function getEmail(): ?string
13✔
90
    {
91
        return $this->email;
13✔
92
    }
93

94
    public function setEmail(?string $email): void
7✔
95
    {
96
        $this->email = $email;
7✔
97
    }
98

99
    public function getWebsite(): ?string
13✔
100
    {
101
        return $this->website;
13✔
102
    }
103

104
    public function setWebsite(?string $website): void
×
105
    {
106
        $this->website = $website;
×
107
    }
108

109
    public function getDate(): ?\DateTime
8✔
110
    {
111
        return $this->date;
8✔
112
    }
113

114
    public function setDate(\DateTime $date): void
×
115
    {
116
        $this->date = $date;
×
117
    }
118

119
    public function getText(): ?string
13✔
120
    {
121
        return $this->text;
13✔
122
    }
123

124
    /**
125
     * Returns the plain text without tags.
126
     */
127
    public function getPlainText(): string
3✔
128
    {
129
        return $this->text ? strip_tags($this->text) : '';
3✔
130
    }
131

132
    public function setText(?string $text): void
7✔
133
    {
134
        $this->text = $text;
7✔
135
    }
136

137
    public function getApproved(): bool
7✔
138
    {
139
        return $this->approved;
7✔
140
    }
141

142
    public function setApproved(bool $approved): void
9✔
143
    {
144
        $this->approved = (boolean) $approved;
9✔
145
    }
146

147
    public function isApproved(): bool
7✔
148
    {
149
        return $this->getApproved();
7✔
150
    }
151

152
    public function getSpam(): bool
11✔
153
    {
154
        return $this->spam;
11✔
155
    }
156

157
    public function setSpam(bool $spam): void
8✔
158
    {
159
        $this->spam = $spam;
8✔
160
    }
161

162
    public function setSpamPoints(int $spamPoints): void
4✔
163
    {
164
        $this->spamPoints = $spamPoints;
4✔
165
    }
166

167
    public function getSpamPoints(): ?int
4✔
168
    {
169
        return $this->spamPoints;
4✔
170
    }
171

172
    public function isSpam(): bool
11✔
173
    {
174
        return $this->getSpam();
11✔
175
    }
176

177
    /**
178
     * Mark comment as spam.
179
     */
180
    public function markAsSpam(): void
2✔
181
    {
182
        $this->spam = true;
2✔
183
    }
184

185
    public function setPostId(int $postId): void
×
186
    {
187
        $this->postId = $postId;
×
188
    }
189

190
    public function getPostId(): ?int
×
191
    {
192
        return $this->postId;
×
193
    }
194

195
    public function getPost(): ?Post
13✔
196
    {
197
        if ($this->post === null && $this->postId !== null) {
13✔
198
            $this->post = $this->getPostRepository()->findByLocalizedUid($this->postId);
13✔
199
        }
200

201
        return $this->post;
13✔
202
    }
203

204
    public function getSubscribe(): bool
6✔
205
    {
206
        return $this->subscribe;
6✔
207
    }
208

209
    public function setSubscribe(bool $subscribe): void
×
210
    {
211
        $this->subscribe = $subscribe;
×
212
    }
213

214
    public function setMailsSent(bool $mailsSent): void
×
215
    {
216
        $this->mailsSent = $mailsSent;
×
217
    }
218

219
    public function getMailsSent(): bool
1✔
220
    {
221
        return $this->mailsSent;
1✔
222
    }
223

224
    public function hasPrivacyPolicyAccepted(): bool
×
225
    {
226
        return $this->privacyPolicyAccepted;
×
227
    }
228

229
    public function setPrivacyPolicyAccepted(bool $privacyPolicyAccepted): void
4✔
230
    {
231
        $this->privacyPolicyAccepted = $privacyPolicyAccepted;
4✔
232
    }
233

234
    /**
235
     * If the comment is shown in frontend.
236
     */
237
    public function isValid(): bool
9✔
238
    {
239
        return !$this->isSpam() && $this->isApproved() && !$this->isHidden() && !$this->isDeleted();
9✔
240
    }
241
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc