Roles   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 40
rs 10
c 0
b 0
f 0
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getRoles() 0 3 1
A removeRole() 0 7 2
A addRole() 0 7 2
1
<?php
2
3
namespace App\Entity\Attribute\Accessor;
4
5
use App\Entity\BusinessUnitRole;
6
7
/**
8
 * Trait Roles
9
 */
10
trait Roles
11
{
12
    /**
13
     * Add role
14
     *
15
     * @param \App\Entity\BusinessUnitRole $role
16
     * @return object
17
     */
18
    public function addRole(BusinessUnitRole $role)
19
    {
20
        if (!$this->roles->contains($role)) {
21
            $this->roles->add($role);
22
        }
23
24
        return $this;
25
    }
26
27
    /**
28
     * Remove role
29
     *
30
     * @param \App\Entity\BusinessUnitRole $role
31
     * @return object
32
     */
33
    public function removeRole(BusinessUnitRole $role)
34
    {
35
        if ($this->roles->contains($role)) {
36
            $this->roles->removeElement($role);
37
        }
38
39
        return $this;
40
    }
41
42
    /**
43
     * Get roles
44
     *
45
     * @return array
46
     */
47
    public function getRoles()
48
    {
49
        return $this->roles->toArray();
50
    }
51
}
52