1 | <?php |
||
23 | class Comments { |
||
24 | use |
||
25 | CRUD_helpers, |
||
26 | Singleton; |
||
27 | |||
28 | /** |
||
29 | * @var Cache\Prefix |
||
30 | */ |
||
31 | protected $cache; |
||
32 | |||
33 | protected $data_model = [ |
||
34 | 'id' => 'int:1', |
||
35 | 'parent' => 'int:0', |
||
36 | 'module' => 'text', |
||
37 | 'item' => 'int:1', |
||
38 | 'user' => 'int:1', |
||
39 | 'date' => 'int:1', |
||
40 | 'text' => 'html', |
||
41 | 'lang' => 'text' |
||
42 | ]; |
||
43 | |||
44 | protected $table = '[prefix]comments'; |
||
45 | |||
46 | protected function construct () { |
||
49 | /** |
||
50 | * Returns database index |
||
51 | * |
||
52 | * @return int |
||
53 | */ |
||
54 | protected function cdb () { |
||
57 | /** |
||
58 | * Get comment data |
||
59 | * |
||
60 | * @param int|int[] $id |
||
61 | * |
||
62 | * @return array|false |
||
63 | */ |
||
64 | function get ($id) { |
||
67 | /** |
||
68 | * Get comment data with user details and formatted date |
||
69 | * |
||
70 | * @param int|int[] $id |
||
71 | * |
||
72 | * @return array|false |
||
1 ignored issue
–
show
|
|||
73 | */ |
||
74 | function get_extended ($id) { |
||
89 | /** |
||
90 | * @param string $module |
||
91 | * @param int $item |
||
92 | * |
||
93 | * @return int[] |
||
94 | */ |
||
95 | function get_for_module_item ($module, $item) { |
||
102 | /** |
||
103 | * Add new comment |
||
104 | * |
||
105 | * @param int $item Item id |
||
106 | * @param string $module Module name |
||
107 | * @param string $text Comment text |
||
108 | * @param int $parent Parent comment id |
||
109 | * |
||
110 | * @return false|int |
||
111 | */ |
||
112 | function add ($item, $module, $text, $parent = 0) { |
||
131 | /** |
||
132 | * Set comment text |
||
133 | * |
||
134 | * @param int $id |
||
135 | * @param string $text |
||
136 | * |
||
137 | * @return bool |
||
138 | */ |
||
139 | function set ($id, $text) { |
||
155 | /** |
||
156 | * Delete comment |
||
157 | * |
||
158 | * @param int $id |
||
159 | * |
||
160 | * @return bool |
||
161 | */ |
||
162 | function del ($id) { |
||
181 | /** |
||
182 | * Delete all comments of specified item |
||
183 | * |
||
184 | * @param int $item Item id |
||
185 | * @param string $module Module name |
||
186 | * |
||
187 | * @return bool |
||
188 | */ |
||
189 | function del_all ($item, $module) { |
||
204 | /** |
||
205 | * Count of comments for specified item |
||
206 | * |
||
207 | * @param int $item Item id |
||
208 | * @param string $module Module name |
||
209 | * |
||
210 | * @return int |
||
211 | */ |
||
212 | function count ($item, $module) { |
||
229 | /** |
||
230 | * Get comments block with comments tree and comments sending form |
||
231 | * |
||
232 | * @param int $item Item id |
||
233 | * @param string $module Module name |
||
234 | * |
||
235 | * @return string |
||
236 | */ |
||
237 | function block ($item, $module) { |
||
246 | } |
||
247 |
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.If the return type contains the type array, this check recommends the use of a more specific type like
String[]
orarray<String>
.