| 1 | <?php |
||
| 21 | class Content { |
||
| 22 | use |
||
| 23 | CRUD_helpers, |
||
| 24 | Singleton; |
||
| 25 | |||
| 26 | protected $data_model = [ |
||
| 27 | 'key' => 'text', |
||
| 28 | 'title' => 'ml:text', |
||
| 29 | 'content' => 'ml:', |
||
| 30 | 'type' => 'set:text,html' |
||
| 31 | ]; |
||
| 32 | protected $table = '[prefix]content'; |
||
| 33 | protected $data_model_ml_group = 'Content'; |
||
| 34 | protected $data_model_files_tag_prefix = 'Content'; |
||
| 35 | /** |
||
| 36 | * @var Prefix |
||
| 37 | */ |
||
| 38 | protected $cache; |
||
| 39 | |||
| 40 | protected function construct () { |
||
| 43 | /** |
||
| 44 | * @inheritdoc |
||
| 45 | */ |
||
| 46 | protected function cdb () { |
||
| 49 | /** |
||
| 50 | * Add new content |
||
| 51 | * |
||
| 52 | * @param string $key Key associated with content, works like id |
||
| 53 | * @param string $title Content title |
||
| 54 | * @param string $content Content itself |
||
| 55 | * @param string $type Type of content: <b>text</b> or <b>html</b>. Influences on editor type |
||
| 56 | * |
||
| 57 | * @return bool |
||
| 58 | */ |
||
| 59 | function add ($key, $title, $content, $type) { |
||
| 67 | /** |
||
| 68 | * @param string $key |
||
| 69 | */ |
||
| 70 | protected function clean_cache ($key) { |
||
| 73 | /** |
||
| 74 | * Get content |
||
| 75 | * |
||
| 76 | * @param string|string[] $key |
||
| 77 | * |
||
| 78 | * @return false|mixed |
||
| 79 | */ |
||
| 80 | function get ($key) { |
||
| 95 | /** |
||
| 96 | * Get keys of all content items |
||
| 97 | * |
||
| 98 | * @return int[]|false |
||
|
1 ignored issue
–
show
|
|||
| 99 | */ |
||
| 100 | function get_all () { |
||
| 103 | /** |
||
| 104 | * Set content |
||
| 105 | * |
||
| 106 | * @param string $key Key associated with content, works like id |
||
| 107 | * @param string $title Content title |
||
| 108 | * @param string $content Content itself |
||
| 109 | * @param string $type Type of content: <b>text</b> or <b>html</b>. Influences on editor type |
||
| 110 | * |
||
| 111 | * @return bool |
||
| 112 | */ |
||
| 113 | function set ($key, $title, $content, $type) { |
||
| 120 | /** |
||
| 121 | * Delete content |
||
| 122 | * |
||
| 123 | * @param string $key |
||
| 124 | * |
||
| 125 | * @return bool |
||
| 126 | */ |
||
| 127 | function del ($key) { |
||
| 134 | } |
||
| 135 |
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.