Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | function latest_version_id() { |
||
28 | $file_id = $this->get_param("file_id"); |
||
29 | |||
30 | $file = $this->jugaad_model->get_file($file_id); |
||
31 | |||
32 | if ($file === false || $file["type"] != "file") { |
||
33 | $this->http->response_code(404); |
||
34 | } |
||
35 | |||
36 | $user_can = $this->perms_model->get_permissions($file_id, $this->user); |
||
37 | |||
38 | if (!$user_can['read_file']) { |
||
39 | $this->http->response_code(403); |
||
40 | } |
||
41 | |||
42 | $version_id = $this->jugaad_model->get_latest_version_id($file_id); |
||
43 | |||
44 | echo $version_id; |
||
45 | } |
||
48 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.