| 1 | <?php |
||
| 13 | class Key { |
||
| 14 | use |
||
| 15 | Singleton; |
||
| 16 | /** |
||
| 17 | * Generates guaranteed unique key |
||
| 18 | * |
||
| 19 | * @param int|\cs\DB\_Abstract $database Keys database |
||
| 20 | * |
||
| 21 | * @return string |
||
|
1 ignored issue
–
show
|
|||
| 22 | * |
||
| 23 | * @throws ExitException |
||
| 24 | */ |
||
| 25 | 2 | function generate ($database) { |
|
| 45 | /** |
||
| 46 | * Adding key into specified database |
||
| 47 | * |
||
| 48 | * @param int|\cs\DB\_Abstract $database Keys database |
||
| 49 | * @param bool|string $key If <b>false</b> - key will be generated automatically, otherwise must contain 56 character [0-9a-z] key |
||
| 50 | * @param null|mixed $data Data to be stored with key |
||
| 51 | * @param int $expire Timestamp of key expiration, if not specified - default system value will be used |
||
| 52 | * |
||
| 53 | * @return false|string |
||
|
1 ignored issue
–
show
|
|||
| 54 | * |
||
| 55 | * @throws ExitException |
||
| 56 | */ |
||
| 57 | 2 | function add ($database, $key, $data = null, $expire = 0) { |
|
| 100 | /** |
||
| 101 | * Check key existence and/or getting of data stored with key. After this key will be deleted automatically. |
||
| 102 | * |
||
| 103 | * @param int|\cs\DB\_Abstract $database Keys database |
||
| 104 | * @param string $key 56 character [0-9a-z] key |
||
| 105 | * @param bool $get_data If <b>true</d> - stored data will be returned on success, otherwise boolean result of key existence will be |
||
| 106 | * returned |
||
| 107 | * |
||
| 108 | * @return bool|mixed |
||
| 109 | * |
||
| 110 | * @throws ExitException |
||
| 111 | */ |
||
| 112 | 2 | function get ($database, $key, $get_data = false) { |
|
| 142 | /** |
||
| 143 | * Key deletion from database |
||
| 144 | * |
||
| 145 | * @param int|\cs\DB\_Abstract $database Keys database |
||
| 146 | * @param string $key 56 character [0-9a-z] key |
||
| 147 | * |
||
| 148 | * @return bool |
||
| 149 | * |
||
| 150 | * @throws ExitException |
||
| 151 | */ |
||
| 152 | 2 | function del ($database, $key) { |
|
| 164 | } |
||
| 165 |
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.