Total Complexity | 14 |
Total Lines | 71 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class SystemPermissions implements PermissionInterface |
||
8 | { |
||
9 | use PermissionTrait; |
||
10 | |||
11 | private static $NONE; |
||
12 | |||
13 | public static function none(): PermissionInterface |
||
14 | { |
||
15 | if (self::$NONE === null) { |
||
16 | self::$NONE = new ProcessDefinitionPermissions("NONE", 0); |
||
17 | } |
||
18 | return self::$NONE; |
||
19 | } |
||
20 | |||
21 | private static $ALL; |
||
22 | |||
23 | public static function all(): PermissionInterface |
||
24 | { |
||
25 | if (self::$ALL === null) { |
||
26 | self::$ALL = new SystemPermissions("ALL", PHP_INT_MAX); |
||
27 | } |
||
28 | return self::$ALL; |
||
29 | } |
||
30 | |||
31 | private static $READ; |
||
32 | |||
33 | public static function read(): PermissionInterface |
||
39 | } |
||
40 | |||
41 | private static $SET; |
||
42 | |||
43 | public static function set(): PermissionInterface |
||
44 | { |
||
45 | if (self::$SET === null) { |
||
46 | self::$SET = new SystemPermissions("SET", 4); |
||
47 | } |
||
48 | return self::$SET; |
||
49 | } |
||
50 | |||
51 | private static $DELETE; |
||
52 | |||
53 | public static function delete(): PermissionInterface |
||
54 | { |
||
55 | if (self::$DELETE === null) { |
||
56 | self::$DELETE = new SystemPermissions("DELETE", 8); |
||
57 | } |
||
58 | return self::$DELETE; |
||
59 | } |
||
60 | |||
61 | public static function resources(): array |
||
62 | { |
||
63 | if (self::$RESOURCES === null) { |
||
64 | self::$RESOURCES = [ Resources::system() ]; |
||
|
|||
65 | } |
||
66 | return self::$RESOURCES; |
||
67 | } |
||
68 | |||
69 | public function getTypes(): array |
||
70 | { |
||
71 | return self::resources(); |
||
72 | } |
||
73 | |||
74 | private function __construct(string $name, int $id) |
||
78 | } |
||
79 | } |
||
80 |