Completed
Push — master ( 20c83d...440e81 )
by Derek Stephen
01:23
created

Role::getClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php declare(strict_types=1);
2
3
namespace Del\Passport\Entity;
4
5
use Del\Passport\RoleInterface;
6
use Doctrine\Common\Collections\ArrayCollection;
7
use Doctrine\Common\Collections\Collection;
8
use Doctrine\ORM\Mapping as ORM;
9
10
/**
11
 * @ORM\Entity
12
 * @ORM\Table(name="Role",uniqueConstraints={@ORM\UniqueConstraint(name="roleName_idx", columns={"roleName"})})
13
 */
14
class Role implements RoleInterface
15
{
16
    /**
17
     * @ORM\Id
18
     * @ORM\Column(type="integer")
19
     * @ORM\GeneratedValue
20
     * @var int $id
21
     */
22
    private $id;
23
24
    /**
25
     * @ORM\Column(type="string",length=50)
26
     * @var string $roleName
27
     */
28
    private $roleName;
29
30
    /**
31
     * A role can have various roles under it
32
     * @ORM\OneToMany(targetEntity="Role", mappedBy="parentRole")
33
     * @var ArrayCollection $children
34
     */
35
    private $children;
36
37
    /**
38
     * Many role have one parent
39
     * @ORM\ManyToOne(targetEntity="Role", inversedBy="children")
40
     * @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
41
     * @var Role $parentRole
42
     */
43
    private $parentRole;
44
45
    /**
46
     * @ORM\Column(type="string",length=75)
47
     * @var string $class
48
     */
49
    private $class;
50
51
    /**
52
     * @return int
53
     */
54
    public function getId(): int
55
    {
56
        return $this->id;
57
    }
58
59
    /**
60
     * @param int $id
61
     */
62
    public function setId(int $id): void
63
    {
64
        $this->id = $id;
65
    }
66
67
    /**
68
     * @return string
69
     */
70
    public function getRoleName(): string
71
    {
72
        return $this->roleName;
73
    }
74
75
    /**
76
     * @param string $roleName
77
     */
78
    public function setRoleName(string $roleName): void
79
    {
80
        $this->roleName = $roleName;
81
    }
82
83
    /**
84
     * @return Collection
85
     */
86
    public function getChildren(): Collection
87
    {
88
        return $this->children;
89
    }
90
91
    /**
92
     * @param Collection $children
93
     */
94
    public function setChildren(Collection $children): void
95
    {
96
        $this->children = $children;
0 ignored issues
show
Documentation Bug introduced by
It seems like $children of type object<Doctrine\Common\Collections\Collection> is incompatible with the declared type object<Doctrine\Common\C...ctions\ArrayCollection> of property $children.

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...
97
    }
98
99
    /**
100
     * @return Role
101
     */
102
    public function getParentRole(): Role
103
    {
104
        return $this->parentRole;
105
    }
106
107
    /**
108
     * @param Role $parentRole
109
     */
110
    public function setParentRole(Role $parentRole): void
111
    {
112
        $this->parentRole = $parentRole;
113
    }
114
115
    /**
116
     * @return string
117
     */
118
    public function getClass(): string
119
    {
120
        return $this->class;
121
    }
122
123
    /**
124
     * @param string $class
125
     */
126
    public function setClass(string $class): void
127
    {
128
        $this->class = $class;
129
    }
130
}
131
132