1 | <?php |
||
67 | class User { |
||
68 | use |
||
69 | Accessor, |
||
70 | Singleton, |
||
71 | User_data, |
||
72 | User_group, |
||
73 | User_management, |
||
74 | User_permission, |
||
75 | User_profile; |
||
76 | /** |
||
77 | * Id of system guest user |
||
78 | */ |
||
79 | const GUEST_ID = 1; |
||
80 | /** |
||
81 | * Id of first, primary system administrator |
||
82 | */ |
||
83 | const ROOT_ID = 2; |
||
84 | /** |
||
85 | * Id of system group for administrators |
||
86 | */ |
||
87 | const ADMIN_GROUP_ID = 1; |
||
88 | /** |
||
89 | * Id of system group for users |
||
90 | */ |
||
91 | const USER_GROUP_ID = 2; |
||
92 | /** |
||
93 | * Status of active user |
||
94 | */ |
||
95 | const STATUS_ACTIVE = 1; |
||
96 | /** |
||
97 | * Status of inactive user |
||
98 | */ |
||
99 | const STATUS_INACTIVE = 0; |
||
100 | /** |
||
101 | * Status of not activated user |
||
102 | */ |
||
103 | const STATUS_NOT_ACTIVATED = -1; |
||
104 | /** |
||
105 | * @var Cache\Prefix |
||
106 | */ |
||
107 | protected $cache; |
||
108 | /** |
||
109 | * Whether to use memory cache (locally, inside object, may require a lot of memory if working with many users together) |
||
110 | * @var bool |
||
111 | */ |
||
112 | protected $memory_cache = true; |
||
113 | /** |
||
114 | * Returns database index |
||
115 | * |
||
116 | * @return int |
||
117 | */ |
||
118 | 20 | protected function cdb () { |
|
131 | /** |
||
132 | * Check number of sign in attempts (is used by system) |
||
133 | * |
||
134 | * @param string $login_hash Hash (sha224) from login (hash from lowercase string) |
||
135 | * |
||
136 | * @return int Number of attempts |
||
1 ignored issue
–
show
|
|||
137 | */ |
||
138 | function get_sign_in_attempts_count ($login_hash) { |
||
156 | /** |
||
157 | * Process sign in result (is used by system) |
||
158 | * |
||
159 | * @param bool $success |
||
160 | * @param string $login_hash Hash (sha224) from login (hash from lowercase string) |
||
161 | */ |
||
162 | 4 | function sign_in_result ($success, $login_hash) { |
|
201 | /** |
||
202 | * Get data item of current user |
||
203 | * |
||
204 | * @param string|string[] $item |
||
205 | * |
||
206 | * @return false|int|mixed[]|string|User\Properties If <i>$item</i> is integer - cs\User\Properties object will be returned |
||
207 | */ |
||
208 | 16 | function __get ($item) { |
|
214 | /** |
||
215 | * Set data item of current user |
||
216 | * |
||
217 | * @param array|int|string $item Item-value array may be specified for setting several items at once |
||
218 | * @param mixed|null $value |
||
219 | * |
||
220 | * @return bool |
||
1 ignored issue
–
show
|
|||
221 | */ |
||
222 | function __set ($item, $value = null) { |
||
225 | /** |
||
226 | * Is admin |
||
227 | * |
||
228 | * Proxy to \cs\Session::instance()->admin() for convenience |
||
229 | * |
||
230 | * @return bool |
||
231 | */ |
||
232 | 8 | function admin () { |
|
235 | /** |
||
236 | * Is user |
||
237 | * |
||
238 | * Proxy to \cs\Session::instance()->user() for convenience |
||
239 | * |
||
240 | * @return bool |
||
241 | */ |
||
242 | function user () { |
||
245 | /** |
||
246 | * Is guest |
||
247 | * |
||
248 | * Proxy to \cs\Session::instance()->guest() for convenience |
||
249 | * |
||
250 | * @return bool |
||
251 | */ |
||
252 | 6 | function guest () { |
|
255 | /** |
||
256 | * Disable memory cache |
||
257 | * |
||
258 | * Memory cache stores users data inside User class in order to get data faster next time. |
||
259 | * But in case of working with large amount of users this cache can be too large. Disabling will cause some performance drop, but save a lot of RAM. |
||
260 | */ |
||
261 | 6 | function disable_memory_cache () { |
|
266 | } |
||
267 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.