Passed
Pull Request — master (#1882)
by Janko
28:33
created

ShipRumpCategory::setDatabaseId()   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 Method

Rating   Name   Duplication   Size   Complexity  
A ShipRumpCategory::getPoints() 0 4 1
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\JoinColumn;
12
use Doctrine\ORM\Mapping\ManyToOne;
13
use Doctrine\ORM\Mapping\Table;
14
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...
15
use Stu\Orm\Repository\ShipRumpCategoryRepository;
16
17
#[Table(name: 'stu_rumps_categories')]
18
#[Entity(repositoryClass: ShipRumpCategoryRepository::class)]
19
class ShipRumpCategory implements ShipRumpCategoryInterface
20
{
21
    #[Id]
22
    #[Column(type: 'integer')]
23
    #[GeneratedValue(strategy: 'IDENTITY')]
24
    private int $id;
25
26
    #[Column(type: 'string')]
27
    private string $name = '';
28
29
    #[Column(type: 'integer', nullable: true)]
30
    private ?int $database_id = 0;
31
32
    #[Column(type: 'integer')]
33
    private int $points = 0;
34
35
    #[ManyToOne(targetEntity: 'DatabaseEntry')]
36
    #[JoinColumn(name: 'database_id', referencedColumnName: 'id')]
37
    private ?DatabaseEntryInterface $databaseEntry = null;
38
39
    #[Override]
40
    public function getId(): int
41
    {
42
        return $this->id;
43
    }
44
45
    #[Override]
46
    public function getName(): string
47
    {
48
        return $this->name;
49
    }
50
51
    #[Override]
52
    public function setName(string $name): ShipRumpCategoryInterface
53
    {
54
        $this->name = $name;
55
56
        return $this;
57
    }
58
59
    #[Override]
60
    public function getDatabaseId(): int
61
    {
62
        return $this->database_id;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->database_id could return the type null which is incompatible with the type-hinted return integer. Consider adding an additional type-check to rule them out.
Loading history...
63
    }
64
65
    //@deprecated
66
    #[Override]
67
    public function getPoints(): int
68
    {
69
        return $this->points;
70
    }
71
72
    #[Override]
73
    public function setPoints(int $points): ShipRumpCategoryInterface
74
    {
75
        $this->points = $points;
76
77
        return $this;
78
    }
79
80
    #[Override]
81
    public function getDatabaseEntry(): ?DatabaseEntryInterface
82
    {
83
        return $this->databaseEntry;
84
    }
85
86
    #[Override]
87
    public function setDatabaseEntry(?DatabaseEntryInterface $databaseEntry): ShipRumpCategoryInterface
88
    {
89
        $this->databaseEntry = $databaseEntry;
90
91
        return $this;
92
    }
93
}
94