Passed
Pull Request — master (#1943)
by Nico
24:24 queued 10:41
created

KnComment::getUserId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Orm\Entity;
6
7
use Doctrine\ORM\Mapping\Column;
8
use Doctrine\ORM\Mapping\Entity;
9
use Doctrine\ORM\Mapping\GeneratedValue;
10
use Doctrine\ORM\Mapping\Id;
11
use Doctrine\ORM\Mapping\Index;
12
use Doctrine\ORM\Mapping\JoinColumn;
13
use Doctrine\ORM\Mapping\ManyToOne;
14
use Doctrine\ORM\Mapping\Table;
15
use Override;
0 ignored issues
show
Bug introduced by
The type Override was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use Stu\Orm\Repository\KnCommentRepository;
17
18
#[Table(name: 'stu_kn_comments')]
19
#[Index(name: 'kn_comment_post_idx', columns: ['post_id'])]
20
#[Index(name: 'kn_comment_user_idx', columns: ['user_id'])]
21
#[Entity(repositoryClass: KnCommentRepository::class)]
22
class KnComment implements KnCommentInterface
23
{
24
    #[Id]
25
    #[Column(type: 'integer')]
26
    #[GeneratedValue(strategy: 'IDENTITY')]
27
    private int $id;
28
29
    #[Column(type: 'integer')]
30
    private int $post_id = 0;
31
32
    #[Column(type: 'integer')]
33
    private int $user_id = 0;
34
35
    #[Column(type: 'string')]
36
    private string $username = '';
37
38
    #[Column(type: 'string')]
39
    private string $text = '';
40
41
    #[Column(type: 'integer')]
42
    private int $date = 0;
43
44
    #[Column(type: 'integer', nullable: true)]
45
    private ?int $deleted = null;
46
47
    #[ManyToOne(targetEntity: 'KnPost')]
48
    #[JoinColumn(name: 'post_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
49
    private KnPostInterface $post;
50
51
    #[ManyToOne(targetEntity: 'User')]
52
    #[JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
53
    private UserInterface $user;
54
55 1
    #[Override]
56
    public function getId(): int
57
    {
58 1
        return $this->id;
59
    }
60
61
    #[Override]
62
    public function getKnId(): int
63
    {
64
        return $this->post_id;
65
    }
66
67
    #[Override]
68
    public function setPostId(int $postId): KnCommentInterface
69
    {
70
        $this->post_id = $postId;
71
72
        return $this;
73
    }
74
75
    #[Override]
76
    public function getUserId(): int
77
    {
78
        return $this->user_id;
79
    }
80
81 1
    #[Override]
82
    public function getUser(): UserInterface
83
    {
84 1
        return $this->user;
85
    }
86
87
    #[Override]
88
    public function setUser(UserInterface $user): KnCommentInterface
89
    {
90
        $this->user = $user;
91
        return $this;
92
    }
93
94 1
    #[Override]
95
    public function getUsername(): string
96
    {
97 1
        return $this->username;
98
    }
99
100
    #[Override]
101
    public function setUsername(string $username): KnCommentInterface
102
    {
103
        $this->username = $username;
104
105
        return $this;
106
    }
107
108 1
    #[Override]
109
    public function getText(): string
110
    {
111 1
        return $this->text;
112
    }
113
114
    #[Override]
115
    public function setText(string $text): KnCommentInterface
116
    {
117
        $this->text = $text;
118
119
        return $this;
120
    }
121
122 1
    #[Override]
123
    public function getDate(): int
124
    {
125 1
        return $this->date;
126
    }
127
128
    #[Override]
129
    public function setDate(int $date): KnCommentInterface
130
    {
131
        $this->date = $date;
132
133
        return $this;
134
    }
135
136 1
    #[Override]
137
    public function getPosting(): KnPostInterface
138
    {
139 1
        return $this->post;
140
    }
141
142
    #[Override]
143
    public function setPosting(KnPostInterface $post): KnCommentInterface
144
    {
145
        $this->post = $post;
146
147
        return $this;
148
    }
149
150
    #[Override]
151
    public function setDeleted(int $timestamp): KnCommentInterface
152
    {
153
        $this->deleted = $timestamp;
154
155
        return $this;
156
    }
157
158 1
    #[Override]
159
    public function isDeleted(): bool
160
    {
161 1
        return $this->deleted !== null;
162
    }
163
}
164