AdventureStep   A
last analyzed

Complexity

Total Complexity 15

Size/Duplication

Total Lines 158
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 15
lcom 0
cbo 0
dl 0
loc 158
rs 10
c 0
b 0
f 0

15 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A setTitle() 0 6 1
A getTitle() 0 4 1
A setDescription() 0 6 1
A getDescription() 0 4 1
A setPosition() 0 6 1
A getPosition() 0 4 1
A setRewardPoint() 0 6 1
A getRewardPoint() 0 4 1
A setBadge() 0 6 1
A getBadge() 0 4 1
A setAdventure() 0 6 1
A getAdventure() 0 4 1
A getCompletions() 0 4 1
A setCompletions() 0 4 1
1
<?php
2
3
namespace Badger\Bundle\GameBundle\Entity;
4
5
use Badger\Component\Game\Model\AdventureInterface;
6
use Badger\Component\Game\Model\AdventureStepInterface;
7
use Badger\Component\Game\Model\BadgeInterface;
8
use Doctrine\Common\Collections\ArrayCollection;
9
10
/**
11
 * Adventure Step
12
 *
13
 * @author  Marie Bochu <[email protected]>
14
 * @license http://opensource.org/licenses/MIT The MIT License (MIT)
15
 */
16
class AdventureStep implements AdventureStepInterface
17
{
18
    /** @var int */
19
    private $id;
20
21
    /** @var string */
22
    private $title;
23
24
    /** @var string */
25
    private $description;
26
27
    /** @var int */
28
    private $position;
29
30
    /** @var int */
31
    private $rewardPoint;
32
33
    /** @var Badge */
34
    private $badge;
35
36
    /** @var Adventure */
37
    private $adventure;
38
39
    /** @var ArrayCollection */
40
    private $completions;
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function getId()
46
    {
47
        return $this->id;
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function setTitle($title)
54
    {
55
        $this->title = $title;
56
57
        return $this;
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function getTitle()
64
    {
65
        return $this->title;
66
    }
67
68
    /**
69
     * {@inheritdoc}
70
     */
71
    public function setDescription($description)
72
    {
73
        $this->description = $description;
74
75
        return $this;
76
    }
77
78
    /**
79
     * {@inheritdoc}
80
     */
81
    public function getDescription()
82
    {
83
        return $this->description;
84
    }
85
86
    /**
87
     * {@inheritdoc}
88
     */
89
    public function setPosition($position)
90
    {
91
        $this->position = $position;
92
93
        return $this;
94
    }
95
96
    /**
97
     * {@inheritdoc}
98
     */
99
    public function getPosition()
100
    {
101
        return $this->position;
102
    }
103
104
    /**
105
     * {@inheritdoc}
106
     */
107
    public function setRewardPoint($rewardPoint)
108
    {
109
        $this->rewardPoint = $rewardPoint;
110
111
        return $this;
112
    }
113
114
    /**
115
     * {@inheritdoc}
116
     */
117
    public function getRewardPoint()
118
    {
119
        return $this->rewardPoint;
120
    }
121
122
    /**
123
     * {@inheritdoc}
124
     */
125
    public function setBadge(BadgeInterface $badge)
126
    {
127
        $this->badge = $badge;
0 ignored issues
show
Documentation Bug introduced by
$badge is of type object<Badger\Component\...e\Model\BadgeInterface>, but the property $badge was declared to be of type object<Badger\Bundle\GameBundle\Entity\Badge>. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
128
129
        return $this;
130
    }
131
132
    /**
133
     * {@inheritdoc}
134
     */
135
    public function getBadge()
136
    {
137
        return $this->badge;
138
    }
139
140
    /**
141
     * {@inheritdoc}
142
     */
143
    public function setAdventure(AdventureInterface $adventure)
144
    {
145
        $this->adventure = $adventure;
0 ignored issues
show
Documentation Bug introduced by
$adventure is of type object<Badger\Component\...del\AdventureInterface>, but the property $adventure was declared to be of type object<Badger\Bundle\GameBundle\Entity\Adventure>. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
146
147
        return $this;
148
    }
149
150
    /**
151
     * {@inheritdoc}
152
     */
153
    public function getAdventure()
154
    {
155
        return $this->adventure;
156
    }
157
158
    /**
159
     * {@inheritdoc}
160
     */
161
    public function getCompletions()
162
    {
163
        return $this->completions;
164
    }
165
166
    /**
167
     * {@inheritdoc}
168
     */
169
    public function setCompletions($completions)
170
    {
171
        $this->completions = $completions;
172
    }
173
}
174