Package::__construct()   A
last analyzed

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
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php declare(strict_types=1);
2
3
/**
4
 * This file is part of Packy.
5
 *
6
 * (c) Peter Nijssen
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace AppBundle\Entity;
13
14
use Doctrine\Common\Collections\ArrayCollection;
15
use Doctrine\Common\Collections\Collection;
16
17
class Package
18
{
19
    /**
20
     * @var int
21
     */
22
    private $id;
23
24
    /**
25
     * @var string
26
     */
27
    private $name;
28
29
    /**
30
     * @var string
31
     */
32
    private $manager;
33
34
    /**
35
     * @var string
36
     */
37
    private $latestVersion;
38
39
    /**
40
     * @var \DateTime
41
     */
42
    private $lastCheckAt;
43
44
    /**
45
     * @var \DateTime
46
     */
47
    private $createdAt;
48
49
    /**
50
     * @var \DateTime
51
     */
52
    private $updatedAt;
53
54
    /**
55
     * @var Collection
56
     */
57
    private $dependencies;
58
59
    /**
60
     * Constructor.
61
     */
62
    public function __construct()
63
    {
64
        $this->dependencies = new ArrayCollection();
65
    }
66
67
    /**
68
     * Get id.
69
     *
70
     * @return int
71
     */
72
    public function getId(): int
73
    {
74
        return $this->id;
75
    }
76
77
    /**
78
     * Set name.
79
     *
80
     * @param string $name
81
     */
82
    public function setName(string $name)
83
    {
84
        $this->name = $name;
85
    }
86
87
    /**
88
     * Get name.
89
     *
90
     * @return string
91
     */
92
    public function getName(): string
93
    {
94
        return $this->name;
95
    }
96
97
    /**
98
     * Set manager.
99
     *
100
     * @param string $manager
101
     */
102
    public function setManager(string $manager)
103
    {
104
        $this->manager = $manager;
105
    }
106
107
    /**
108
     * Get manager.
109
     *
110
     * @return string
111
     */
112
    public function getManager(): string
113
    {
114
        return $this->manager;
115
    }
116
117
    /**
118
     * Set latestVersion.
119
     *
120
     * @param string $latestVersion
121
     */
122
    public function setLatestVersion(string $latestVersion)
123
    {
124
        $this->latestVersion = $latestVersion;
125
    }
126
127
    /**
128
     * Get latestVersion.
129
     *
130
     * @return string|null
131
     */
132
    public function getLatestVersion(): ?string
133
    {
134
        return $this->latestVersion;
135
    }
136
137
    /**
138
     * Set $lastCheckAt.
139
     *
140
     * @param \DateTimeInterface $lastCheckAt
141
     */
142
    public function setLastCheckAt(\DateTimeInterface $lastCheckAt)
143
    {
144
        $this->lastCheckAt = $lastCheckAt;
0 ignored issues
show
Documentation Bug introduced by
$lastCheckAt is of type object<DateTimeInterface>, but the property $lastCheckAt was declared to be of type object<DateTime>. 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...
145
    }
146
147
    /**
148
     * Get lastCheckAt.
149
     *
150
     * @return \DateTimeInterface
151
     */
152
    public function getLastCheckAt(): \DateTimeInterface
153
    {
154
        return $this->lastCheckAt;
155
    }
156
157
    /**
158
     * Set createdAt.
159
     *
160
     * @param \DateTimeInterface $createdAt
161
     */
162
    public function setCreatedAt(\DateTimeInterface $createdAt)
163
    {
164
        $this->createdAt = $createdAt;
0 ignored issues
show
Documentation Bug introduced by
$createdAt is of type object<DateTimeInterface>, but the property $createdAt was declared to be of type object<DateTime>. 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...
165
    }
166
167
    /**
168
     * Get createdAt.
169
     *
170
     * @return \DateTimeInterface
171
     */
172
    public function getCreatedAt(): \DateTimeInterface
173
    {
174
        return $this->createdAt;
175
    }
176
177
    /**
178
     * Set updatedAt.
179
     *
180
     * @param \DateTimeInterface $updatedAt
181
     */
182
    public function setUpdatedAt(\DateTimeInterface $updatedAt)
183
    {
184
        $this->updatedAt = $updatedAt;
0 ignored issues
show
Documentation Bug introduced by
$updatedAt is of type object<DateTimeInterface>, but the property $updatedAt was declared to be of type object<DateTime>. 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...
185
    }
186
187
    /**
188
     * Get updatedAt.
189
     *
190
     * @return \DateTimeInterface
191
     */
192
    public function getUpdatedAt(): \DateTimeInterface
193
    {
194
        return $this->updatedAt;
195
    }
196
197
    /**
198
     * Add dependencies.
199
     *
200
     * @param Dependency $dependencies
201
     */
202
    public function addDependency(Dependency $dependencies)
203
    {
204
        $this->dependencies[] = $dependencies;
205
    }
206
207
    /**
208
     * Remove dependencies.
209
     *
210
     * @param Dependency $dependencies
211
     */
212
    public function removeDependency(Dependency $dependencies)
213
    {
214
        $this->dependencies->removeElement($dependencies);
215
    }
216
217
    /**
218
     * Get dependencies.
219
     *
220
     * @return Collection
221
     */
222
    public function getDependencies(): Collection
223
    {
224
        return $this->dependencies;
225
    }
226
}
227