Completed
Push — develop ( e1a849...b559a4 )
by
unknown
15:15 queued 07:42
created

Cv::getSkills()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 7
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
namespace Cv\Entity;
4
5
use Core\Entity\AbstractIdentifiableEntity;
6
use Doctrine\Common\Collections\Collection as CollectionInterface;
7
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
8
use Auth\Entity\UserInterface;
9
use Doctrine\Common\Collections\ArrayCollection;
10
use Core\Entity\DraftableEntityInterface;
11
12
/**
13
 *
14
 * @ODM\Document(collection="cvs", repositoryClass="\Cv\Repository\Cv")
15
 */
16
class Cv extends AbstractIdentifiableEntity implements CvInterface, DraftableEntityInterface
17
{
18
    
19
    /**
20
     * Owner of the CV
21
     *
22
     * @var UserInterface
23
     * @ODM\ReferenceOne(targetDocument="\Auth\Entity\User", simple=true)
24
     * @ODM\Index
25
     */
26
    protected $user;
27
    
28
    /**
29
     * Education History
30
     *
31
     * @var ArrayCollection
32
     * @ODM\EmbedMany(targetDocument="\Cv\Entity\Education")
33
     */
34
    protected $educations;
35
    
36
    /**
37
     * Employment History
38
     *
39
     * @var ArrayCollection
40
     * @ODM\EmbedMany(targetDocument="\Cv\Entity\Employment")
41
     */
42
    protected $employments;
43
    
44
    /**
45
     * Skills
46
     *
47
     * @var ArrayCollection
48
     * @ODM\EmbedMany(targetDocument="\Cv\Entity\Skill")
49
     */
50
    protected $skills;
51
52
    /**
53
     * Flag indicating draft state of this cv.
54
     *
55
     * @var bool
56
     * @ODM\Boolean
57
     */
58
    protected $isDraft = false;
59
60
    /**
61
     * @return UserInterface
62
     */
63
    public function getUser()
64
    {
65
        return $this->user;
66
    }
67
68
    /**
69
     * @param UserInterface $user
70
     * @return $this
71
     */
72
    public function setUser(UserInterface $user)
73
    {
74
        $this->user = $user;
75
        return $this;
76
    }
77
    
78
    /**
79
     * @return ArrayCollection
80
     */
81
    public function getEducations()
82
    {
83
        if (!$this->educations) {
84
            $this->setEducations(new ArrayCollection());
85
        }
86
        return $this->educations;
87
    }
88
89
    /**
90
     * @param CollectionInterface $educations
91
     * @return $this
92
     */
93
    public function setEducations(CollectionInterface $educations)
94
    {
95
        $this->educations = $educations;
0 ignored issues
show
Documentation Bug introduced by
$educations is of type object<Doctrine\Common\Collections\Collection>, but the property $educations was declared to be of type object<Doctrine\Common\C...ctions\ArrayCollection>. 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...
96
        return $this;
97
    }
98
99
    /**
100
     * @return ArrayCollection
101
     */
102
    public function getEmployments()
103
    {
104
        if (!$this->employments) {
105
            $this->setEmployments(new ArrayCollection());
106
        }
107
        return $this->employments;
108
    }
109
110
    /**
111
     * @param CollectionInterface $employments
112
     * @return $this
113
     */
114
    public function setEmployments(CollectionInterface $employments)
115
    {
116
        $this->employments = $employments;
0 ignored issues
show
Documentation Bug introduced by
$employments is of type object<Doctrine\Common\Collections\Collection>, but the property $employments was declared to be of type object<Doctrine\Common\C...ctions\ArrayCollection>. 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...
117
        return $this;
118
    }
119
    
120
    /**
121
     * @return ArrayCollection
122
     */
123
    public function getSkills()
124
    {
125
        if (!$this->skills) {
126
            $this->setSkills(new ArrayCollection());
127
        }
128
        return $this->skills;
129
    }
130
131
    /**
132
     * @param CollectionInterface $skills
133
     * @return $this
134
     */
135
    public function setSkills(CollectionInterface $skills)
136
    {
137
        $this->skills = $skills;
0 ignored issues
show
Documentation Bug introduced by
$skills is of type object<Doctrine\Common\Collections\Collection>, but the property $skills was declared to be of type object<Doctrine\Common\C...ctions\ArrayCollection>. 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...
138
        return $this;
139
    }
140
141
    public function setIsDraft($isDraft)
142
    {
143
        $this->isDraft=$isDraft;
144
        return $this;
145
    }
146
147
    /**
148
     * @return boolean
149
     */
150
    public function isDraft()
151
    {
152
        return $this->isDraft;
153
    }
154
155
}
156