Conditions | 8 |
Paths | 64 |
Total Lines | 28 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function __construct($user = null, array $attributes = [], $providerKey, array $roles = []) |
||
17 | { |
||
18 | $this->setUser($user); |
||
19 | |||
20 | $this->setAttributes($attributes); |
||
21 | |||
22 | $this->providerKey = $providerKey; |
||
23 | |||
24 | if (empty($roles) && $user instanceof UserInterface) { |
||
25 | $roles = $user->getRoles(); |
||
26 | } |
||
27 | if ($this->isStudent()) { |
||
28 | $roles[] = 'ROLE_STUDENT'; |
||
29 | } |
||
30 | if ($this->isEmployee()) { |
||
31 | $roles[] = 'ROLE_EMPLOYEE'; |
||
32 | } |
||
33 | if ($this->isFaculty()) { |
||
34 | $roles[] = 'ROLE_FACULTY'; |
||
35 | } |
||
36 | if ($this->isMember()) { |
||
37 | $roles[] = 'ROLE_MEMBER'; |
||
38 | } |
||
39 | if ($this->isStaff()) { |
||
40 | $roles[] = 'ROLE_STAFF'; |
||
41 | } |
||
42 | parent::__construct($roles); |
||
43 | } |
||
44 | |||
55 |