Total Complexity | 3 |
Total Lines | 66 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | class Role |
||
17 | { |
||
18 | /** |
||
19 | * Role name |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | public $role; |
||
24 | |||
25 | /** |
||
26 | * Role level |
||
27 | * |
||
28 | * @var int |
||
29 | */ |
||
30 | public $level; |
||
31 | |||
32 | /** |
||
33 | * Role permissions |
||
34 | * |
||
35 | * @var ArrayObject |
||
36 | */ |
||
37 | public $permissions; |
||
38 | |||
39 | /** |
||
40 | * Role group name |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | public $group; |
||
45 | |||
46 | /** |
||
47 | * Role constructor. |
||
48 | * |
||
49 | * @param string $role Role name |
||
50 | * @param int $level Level of the role |
||
51 | */ |
||
52 | public function __construct(string $role, int $level) |
||
53 | { |
||
54 | $this->role = $role; |
||
55 | $this->level = $level; |
||
56 | $this->permissions = new ArrayObject(); |
||
57 | $this->group = null; |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * Set role permissions |
||
62 | * |
||
63 | * @param array $permissions New permissions |
||
64 | * |
||
65 | * @return void |
||
66 | */ |
||
67 | public function setPermissions(array $permissions): void |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * Set role group |
||
74 | * |
||
75 | * @param string $groupName New group to be associated with the role |
||
76 | * |
||
77 | * @return void |
||
78 | */ |
||
79 | public function setGroup(string $groupName): void |
||
84 | } |