| 1 | <?php |
||
| 13 | class Text { |
||
| 14 | use Singleton; |
||
| 15 | /** |
||
| 16 | * Gets text on current language |
||
| 17 | * |
||
| 18 | * @param int $database |
||
| 19 | * @param int|null $id Getting may be done with group and label or with id |
||
| 20 | * @param bool $store_in_cache If `true` - text will be stored in cache |
||
| 21 | * |
||
| 22 | * @return false|string |
||
| 23 | */ |
||
| 24 | 2 | function get ($database, $id = null, $store_in_cache = false) { |
|
| 41 | /** |
||
| 42 | * @param int $database |
||
| 43 | * @param string $clang |
||
| 44 | * @param int $id |
||
| 45 | * |
||
| 46 | * @return false|string |
||
| 47 | */ |
||
| 48 | 2 | protected function get_text_by_id ($database, $clang, $id) { |
|
| 73 | /** |
||
| 74 | * Search for text regardless language |
||
| 75 | * |
||
| 76 | * @param int $database |
||
| 77 | * @param string $group |
||
| 78 | * @param string $label |
||
| 79 | * @param string $text |
||
| 80 | * |
||
| 81 | * @return array[]|false Array of items `['id' => id, 'lang' => lang]` on success, `false` otherwise |
||
| 82 | */ |
||
| 83 | function search ($database, $group, $label, $text) { |
||
| 100 | /** |
||
| 101 | * Sets text on current language |
||
| 102 | * |
||
| 103 | * @param int $database |
||
| 104 | * @param string $group |
||
| 105 | * @param string $label |
||
| 106 | * @param string $text |
||
| 107 | * |
||
| 108 | * @return false|string If multilingual support enabled or was enabled and then disabled but translations remains - returns {¶<i>id</i>}, otherwise returns |
||
| 109 | * original text |
||
| 110 | */ |
||
| 111 | 2 | function set ($database, $group, $label, $text) { |
|
| 159 | /** |
||
| 160 | * @param int $id |
||
| 161 | * @param string $text |
||
| 162 | * @param DB\_Abstract $cdb |
||
| 163 | * @param bool $multilingual |
||
| 164 | * @param string $clang |
||
| 165 | * |
||
| 166 | * @return mixed |
||
| 167 | */ |
||
| 168 | 2 | protected function set_text ($id, $text, $cdb, $multilingual, $clang) { |
|
| 224 | /** |
||
| 225 | * Deletes text on all languages |
||
| 226 | * |
||
| 227 | * @param int $database |
||
| 228 | * @param string $group |
||
| 229 | * @param string $label |
||
| 230 | * |
||
| 231 | * @return bool |
||
| 232 | */ |
||
| 233 | function del ($database, $group, $label) { |
||
| 263 | /** |
||
| 264 | * Process text, and replace {¶([0-9]+)} on real text, is used before showing multilingual information |
||
| 265 | * |
||
| 266 | * @param int $database |
||
| 267 | * @param string|string[] $data |
||
| 268 | * @param bool $store_in_cache If <b>true</b> - text will be stored in cache |
||
| 269 | * |
||
| 270 | * @return string|string[] |
||
|
1 ignored issue
–
show
|
|||
| 271 | */ |
||
| 272 | 36 | function process ($database, $data, $store_in_cache = false) { |
|
| 287 | } |
||
| 288 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.