Passed
Pull Request — master (#1984)
by Nico
20:34 queued 10:19
created

ConstructionProgress::getRemainingTicks()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
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\JoinColumn;
14
use Doctrine\ORM\Mapping\OneToMany;
15
use Doctrine\ORM\Mapping\OneToOne;
16
use Doctrine\ORM\Mapping\OrderBy;
17
use Doctrine\ORM\Mapping\Table;
18
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...
19
use Stu\Orm\Repository\ConstructionProgressRepository;
20
21
#[Table(name: 'stu_construction_progress')]
22
#[Entity(repositoryClass: ConstructionProgressRepository::class)]
23
class ConstructionProgress implements ConstructionProgressInterface
24
{
25
    #[Id]
26
    #[Column(type: 'integer')]
27
    #[GeneratedValue(strategy: 'IDENTITY')]
28
    private int $id;
29
30
    #[Column(type: 'integer')]
31
    private int $station_id = 0;
32
33
    #[Column(type: 'integer')]
34
    private int $remaining_ticks = 0;
35
36
    /**
37
     * @var ArrayCollection<int, ConstructionProgressModuleInterface>
38
     */
39
    #[OneToMany(targetEntity: 'ConstructionProgressModule', mappedBy: 'progress', indexBy: 'module_id')]
40
    #[OrderBy(['module_id' => 'ASC'])]
41
    private Collection $specialModules;
42
43
    #[OneToOne(targetEntity: 'Station')]
44
    #[JoinColumn(name: 'station_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
45
    private StationInterface $station;
46
47
    public function __construct()
48
    {
49
        $this->specialModules = new ArrayCollection();
50
    }
51
52
    #[Override]
53
    public function getId(): int
54
    {
55
        return $this->id;
56
    }
57
58
    #[Override]
59
    public function getStation(): StationInterface
60
    {
61
        return $this->station;
62
    }
63
64
    #[Override]
65
    public function setStation(StationInterface $station): ConstructionProgressInterface
66
    {
67
        $this->station = $station;
68
69
        return $this;
70
    }
71
72 1
    #[Override]
73
    public function getSpecialModules(): Collection
74
    {
75 1
        return $this->specialModules;
76
    }
77
78 1
    #[Override]
79
    public function getRemainingTicks(): int
80
    {
81 1
        return $this->remaining_ticks;
82
    }
83
84
    #[Override]
85
    public function setRemainingTicks(int $remainingTicks): ConstructionProgressInterface
86
    {
87
        $this->remaining_ticks = $remainingTicks;
88
89
        return $this;
90
    }
91
92
    #[Override]
93
    public function __toString(): string
94
    {
95
        return sprintf('constructionProgress, stationId: %d', $this->station_id);
96
    }
97
}
98