Total Complexity | 7 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
13 | abstract class AbstractRole |
||
14 | { |
||
15 | protected $role; |
||
16 | |||
17 | protected $permissions; |
||
18 | |||
19 | private final function __construct() |
||
20 | { |
||
21 | } |
||
22 | |||
23 | final public static function getRoleName(): string |
||
24 | { |
||
25 | $role = static::singleton()->role; |
||
26 | |||
27 | if (!isset($role)) { |
||
28 | throw new Exception('Role name not set for ' . get_short_class_name(static::class)); |
||
29 | } |
||
30 | |||
31 | return $role; |
||
32 | } |
||
33 | |||
34 | final public static function getPermissions(): array |
||
47 | } |
||
48 | |||
49 | public static function singleton() |
||
52 | } |
||
53 | } |
||
54 |