Passed
Push — dev ( 7afdcb...e5a558 )
by Nico
14:32
created

DatabaseCategory::getAward()   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\Common\Collections\ArrayCollection;
8
use Doctrine\Common\Collections\Collection;
9
use Doctrine\ORM\Mapping\Column;
10
use Doctrine\ORM\Mapping\Entity;
11
use Doctrine\ORM\Mapping\GeneratedValue;
12
use Doctrine\ORM\Mapping\Id;
13
use Doctrine\ORM\Mapping\OneToMany;
14
use Doctrine\ORM\Mapping\OrderBy;
15
use Doctrine\ORM\Mapping\Table;
16
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...
17
use Stu\Orm\Repository\DatabaseCategoryRepository;
18
19
#[Table(name: 'stu_database_categories')]
20
#[Entity(repositoryClass: DatabaseCategoryRepository::class)]
21
class DatabaseCategory implements DatabaseCategoryInterface
22
{
23
    #[Id]
24
    #[Column(type: 'integer')]
25
    #[GeneratedValue(strategy: 'IDENTITY')]
26
    private int $id;
27
28
    #[Column(type: 'string')]
29
    private string $description;
30
31
    #[Column(type: 'integer')]
32
    private int $points;
33
34
    #[Column(type: 'integer')]
35
    private int $type;
36
37
    #[Column(type: 'integer')]
38
    private int $sort;
39
40
    #[Column(type: 'integer')]
41
    private int $prestige;
42
43
    /**
44
     * @var ArrayCollection<int, DatabaseEntryInterface>
45
     */
46
    #[OneToMany(targetEntity: DatabaseEntry::class, mappedBy: 'category')]
47
    #[OrderBy(['sort' => 'ASC'])]
48
    private Collection $entries;
49
50
    /**
51
     * @var ArrayCollection<int, DatabaseCategoryAwardInterface>
52
     */
53
    #[OneToMany(targetEntity: DatabaseCategoryAward::class, mappedBy: 'category')]
54
    private Collection $categoryAwards;
55
56
    public function __construct()
57
    {
58
        $this->entries = new ArrayCollection();
59
        $this->categoryAwards = new ArrayCollection();
60
    }
61
62 2
    #[Override]
63
    public function getId(): int
64
    {
65 2
        return $this->id;
66
    }
67
68
    #[Override]
69
    public function setDescription(string $description): DatabaseCategoryInterface
70
    {
71
        $this->description = $description;
72
        return $this;
73
    }
74
75 3
    #[Override]
76
    public function getDescription(): string
77
    {
78 3
        return $this->description;
79
    }
80
81
    #[Override]
82
    public function setPoints(int $points): DatabaseCategoryInterface
83
    {
84
        $this->points = $points;
85
        return $this;
86
    }
87
88
    #[Override]
89
    public function getPoints(): int
90
    {
91
        return $this->points;
92
    }
93
94
    #[Override]
95
    public function setType(int $type): DatabaseCategoryInterface
96
    {
97
        $this->type = $type;
98
        return $this;
99
    }
100
101
    #[Override]
102
    public function getType(): int
103
    {
104
        return $this->type;
105
    }
106
107
    #[Override]
108
    public function setSort(int $sort): DatabaseCategoryInterface
109
    {
110
        $this->sort = $sort;
111
        return $this;
112
    }
113
114
    #[Override]
115
    public function getSort(): int
116
    {
117
        return $this->sort;
118
    }
119
120
    #[Override]
121
    public function getPrestige(): int
122
    {
123
        return $this->prestige;
124
    }
125
126 1
    #[Override]
127
    public function getEntries(): array
128
    {
129 1
        return $this->entries->toArray();
130
    }
131
132
    #[Override]
133
    public function getCategoryAwards(): array
134
    {
135
        return $this->categoryAwards->toArray();
136
    }
137
}
138