1 | <?php |
||
14 | abstract class Auth { |
||
15 | |||
16 | private static $admin = false, $auth = null, $user = null; |
||
17 | |||
18 | /** |
||
19 | * Initialize the session |
||
20 | * |
||
21 | * @property string $section : an active section (SECTION_SITE or SECTION_ADMIN) |
||
22 | * |
||
23 | * @return bool : true on success or false on failure |
||
24 | */ |
||
25 | |||
26 | public static function init(string $section) : bool { |
||
56 | |||
57 | /** |
||
58 | * Delete the session |
||
59 | * |
||
60 | * @return bool : true on success or false on failure |
||
61 | */ |
||
62 | |||
63 | public static function logout() : bool { |
||
83 | |||
84 | /** |
||
85 | * Check whether the initial registration is required (the users table is empty and auto_increment is set to 0) |
||
86 | */ |
||
87 | |||
88 | public static function isInitial() : bool { |
||
98 | |||
99 | /** |
||
100 | * Check whether the authorization mode is set to admin |
||
101 | */ |
||
102 | |||
103 | public static function isAdmin() : bool { |
||
107 | |||
108 | /** |
||
109 | * Check whether the authorization was successful |
||
110 | */ |
||
111 | |||
112 | public static function isLogged() : bool { |
||
116 | |||
117 | /** |
||
118 | * Get the user param |
||
119 | * |
||
120 | * @return mixed|null : the param value or null if the session was not initialized |
||
121 | */ |
||
122 | |||
123 | public static function get(string $name) { |
||
127 | |||
128 | /** |
||
129 | * Return the user entity object |
||
130 | * |
||
131 | * @return Modules\Entitizer\Entity\User|false : the user entity object or false if the session was not initialized |
||
132 | */ |
||
133 | |||
134 | public static function getUser() { |
||
138 | } |
||
139 | } |
||
140 |
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.