Passed
Pull Request — master (#1918)
by Janko
25:50
created

TutorialStep::getNextStepId()   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
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
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\OneToOne;
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\Game\ModuleViewEnum;
17
use Stu\Orm\Repository\TutorialStepRepository;
18
19
#[Table(name: 'stu_tutorial_step')]
20
#[Index(name: 'tutorial_view_idx', columns: ['module', 'view'])]
21
#[Entity(repositoryClass: TutorialStepRepository::class)]
22
class TutorialStep implements TutorialStepInterface
23
{
24
    #[Id]
25
    #[Column(type: 'integer')]
26
    #[GeneratedValue(strategy: 'IDENTITY')]
27
    private int $id;
28
29
    #[Column(type: 'string', length: 50, enumType: ModuleViewEnum::class)]
30
    private ModuleViewEnum $module;
31
32
    #[Column(type: 'string', length: 100)]
33
    private string $view = '';
34
35
    #[Column(type: 'integer', nullable: true)]
36
    private ?int $next_step_id;
37
38
    #[Column(type: 'text', nullable: true)]
39
    private ?string $title = null;
40
41
    #[Column(type: 'text', nullable: true)]
42
    private ?string $text = null;
43
44
    #[Column(type: 'text', nullable: true)]
45
    private ?string $elementIds = null;
46
47
    #[Column(type: 'text', nullable: true)]
48
    private ?string $innerUpdate = null;
49
50
    #[Column(type: 'integer', nullable: true)]
51
    private ?int $fallbackIndex = null;
52
53
    #[OneToOne(targetEntity: 'TutorialStep', mappedBy: 'nextStep')]
54
    private ?TutorialStepInterface $previousStep;
55
56
    #[OneToOne(targetEntity: 'TutorialStep')]
57
    #[JoinColumn(name: 'next_step_id', referencedColumnName: 'id')]
58
    private ?TutorialStepInterface $nextStep;
59
60
    #[Override]
61
    public function getId(): int
62
    {
63
        return $this->id;
64
    }
65
66
    #[Override]
67
    public function getModule(): ModuleViewEnum
68
    {
69
        return $this->module;
70
    }
71
72
    #[Override]
73
    public function setModule(ModuleViewEnum $module): void
74
    {
75
        $this->module = $module;
76
    }
77
78
    #[Override]
79
    public function getView(): string
80
    {
81
        return $this->view;
82
    }
83
84
    #[Override]
85
    public function getPreviousStepId(): ?int
86
    {
87
        $previousStep = $this->getPreviousStep();
88
        if ($previousStep == null) {
89
            return null;
90
        }
91
92
        return $previousStep->getId();
93
    }
94
95
    #[Override]
96
    public function getNextStepId(): ?int
97
    {
98
        return $this->next_step_id;
99
    }
100
101
    #[Override]
102
    public function getPreviousStep(): ?TutorialStepInterface
103
    {
104
        return $this->previousStep;
105
    }
106
107
    #[Override]
108
    public function getNextStep(): ?TutorialStepInterface
109
    {
110
        return $this->nextStep;
111
    }
112
113
    #[Override]
114
    public function getTitle(): ?string
115
    {
116
        return $this->title;
117
    }
118
119
    #[Override]
120
    public function setTitle(?string $title): void
121
    {
122
        $this->title = $title;
123
    }
124
125
    #[Override]
126
    public function getText(): ?string
127
    {
128
        return $this->text;
129
    }
130
131
    #[Override]
132
    public function setText(?string $text): void
133
    {
134
        $this->text = $text;
135
    }
136
137
    #[Override]
138
    public function getElementIds(): ?string
139
    {
140
        return $this->elementIds;
141
    }
142
143
    #[Override]
144
    public function setElementIds(?string $elementIds): void
145
    {
146
        $this->elementIds = $elementIds;
147
    }
148
149
    #[Override]
150
    public function getInnerUpdate(): ?string
151
    {
152
        return $this->innerUpdate;
153
    }
154
155
    #[Override]
156
    public function setInnerUpdate(?string $innerUpdate): void
157
    {
158
        $this->innerUpdate = $innerUpdate;
159
    }
160
161
    #[Override]
162
    public function getFallbackIndex(): ?int
163
    {
164
        return $this->fallbackIndex;
165
    }
166
167
    #[Override]
168
    public function setFallbackIndex(?int $fallbackIndex): void
169
    {
170
        $this->fallbackIndex = $fallbackIndex;
171
    }
172
}
173