Passed
Push — skills ( e6c35a )
by Angel Fernando Quiroz
12:27 queued 14s
created

SkillLevelProfile   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 90
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 27
c 0
b 0
f 0
dl 0
loc 90
rs 10
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A setTitle() 0 5 1
A getSkills() 0 3 1
A getTitle() 0 3 1
A __toString() 0 3 1
A getLevels() 0 3 1
A __construct() 0 4 1
A getId() 0 3 1
A setSkills() 0 5 1
A setLevels() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CoreBundle\Entity;
8
9
use Doctrine\Common\Collections\ArrayCollection;
10
use Doctrine\Common\Collections\Collection;
11
use Doctrine\ORM\Mapping as ORM;
12
use Stringable;
13
14
#[ORM\Table(name: 'skill_level_profile')]
15
#[ORM\Entity]
16
class SkillLevelProfile implements Stringable
17
{
18
    #[ORM\Column(name: 'id', type: 'integer')]
19
    #[ORM\Id]
20
    #[ORM\GeneratedValue]
21
    protected ?int $id = null;
22
23
    #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)]
24
    protected string $title;
25
26
    /**
27
     * @var Collection<int, Skill>
28
     */
29
    #[ORM\OneToMany(mappedBy: 'levelProfile', targetEntity: Skill::class, cascade: ['persist'])]
30
    protected Collection $skills;
31
32
    /**
33
     * @var Collection<int, Level>
34
     */
35
    #[ORM\OneToMany(mappedBy: 'profile', targetEntity: Level::class, cascade: ['persist'])]
36
    #[ORM\OrderBy(['position' => 'ASC'])]
37
    protected Collection $levels;
38
39
    public function __construct()
40
    {
41
        $this->skills = new ArrayCollection();
42
        $this->levels = new ArrayCollection();
43
    }
44
45
    public function __toString(): string
46
    {
47
        return $this->getTitle();
48
    }
49
50
    /**
51
     * @return int
52
     */
53
    public function getId()
54
    {
55
        return $this->id;
56
    }
57
58
    public function getTitle(): string
59
    {
60
        return $this->title;
61
    }
62
63
    public function setTitle(string $title): self
64
    {
65
        $this->title = $title;
66
67
        return $this;
68
    }
69
70
    /**
71
     * @return Skill[]|Collection
72
     */
73
    public function getSkills(): array|Collection
74
    {
75
        return $this->skills;
76
    }
77
78
    /**
79
     * @param Skill[]|Collection $skills
80
     */
81
    public function setSkills(array|Collection $skills): self
82
    {
83
        $this->skills = $skills;
0 ignored issues
show
Documentation Bug introduced by
It seems like $skills of type array is incompatible with the declared type Doctrine\Common\Collections\Collection of property $skills.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
84
85
        return $this;
86
    }
87
88
    /**
89
     * @return Level[]|Collection
90
     */
91
    public function getLevels(): array|Collection
92
    {
93
        return $this->levels;
94
    }
95
96
    /**
97
     * @param Collection $levels
98
     */
99
    public function setLevels($levels): self
100
    {
101
        $this->levels = $levels;
102
103
        return $this;
104
    }
105
}
106