Passed
Push — master ( dc0b89...206b37 )
by Nico
12:39
created

History::setLocation()   A

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 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
ccs 0
cts 3
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\Component\History\HistoryTypeEnum;
17
use Stu\Orm\Repository\HistoryRepository;
18
19
#[Table(name: 'stu_history')]
20
#[Index(name: 'type_idx', columns: ['type'])]
21
#[Entity(repositoryClass: HistoryRepository::class)]
22
class History implements HistoryInterface
23
{
24
    #[Id]
25
    #[Column(type: 'integer')]
26
    #[GeneratedValue(strategy: 'IDENTITY')]
27
    private int $id;
28
29
    #[Column(type: 'text')]
30
    private string $text = '';
31
32
    #[Column(type: 'integer')]
33
    private int $date = 0;
34
35
    #[Column(type: 'smallint', length: 1, enumType: HistoryTypeEnum::class)]
36
    private HistoryTypeEnum $type = HistoryTypeEnum::OTHER;
37
38
    #[Column(type: 'integer', nullable: true)]
39
    private ?int $source_user_id = 0;
40
41
    #[Column(type: 'integer', nullable: true)]
42
    private ?int $target_user_id = 0;
43
44
    #[Column(type: 'integer', nullable: true)]
45
    private ?int $location_id = null;
0 ignored issues
show
introduced by
The private property $location_id is not used, and could be removed.
Loading history...
46
47
    #[ManyToOne(targetEntity: 'Location')]
48
    #[JoinColumn(name: 'location_id', referencedColumnName: 'id')]
49
    private ?LocationInterface $location;
50
51
    #[Override]
52
    public function getId(): int
53
    {
54
        return $this->id;
55
    }
56
57
    #[Override]
58
    public function getText(): string
59
    {
60
        return $this->text;
61
    }
62
63
    #[Override]
64
    public function setText(string $text): HistoryInterface
65
    {
66
        $this->text = $text;
67
68
        return $this;
69
    }
70
71
    #[Override]
72
    public function getDate(): int
73
    {
74
        return $this->date;
75
    }
76
77
    #[Override]
78
    public function setDate(int $date): HistoryInterface
79
    {
80
        $this->date = $date;
81
82
        return $this;
83
    }
84
85
    #[Override]
86
    public function getType(): HistoryTypeEnum
87
    {
88
        return $this->type;
89
    }
90
91
    #[Override]
92
    public function setType(HistoryTypeEnum $type): HistoryInterface
93
    {
94
        $this->type = $type;
95
96
        return $this;
97
    }
98
99
    #[Override]
100
    public function getSourceUserId(): ?int
101
    {
102
        return $this->source_user_id;
103
    }
104
105
    #[Override]
106
    public function setSourceUserId(int $sourceuserId): HistoryInterface
107
    {
108
        $this->source_user_id = $sourceuserId;
109
110
        return $this;
111
    }
112
113
    #[Override]
114
    public function getTargetUserId(): ?int
115
    {
116
        return $this->target_user_id;
117
    }
118
119
    #[Override]
120
    public function setTargetUserId(int $targetuserId): HistoryInterface
121
    {
122
        $this->target_user_id = $targetuserId;
123
124
        return $this;
125
    }
126
127
    #[Override]
128
    public function getLocation(): ?LocationInterface
129
    {
130
        return $this->location;
131
    }
132
133
    #[Override]
134
    public function setLocation(?LocationInterface $location): HistoryInterface
135
    {
136
        $this->location = $location;
137
138
        return $this;
139
    }
140
}
141