Conditions | 5 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | function get_meta($template_name) { |
||
15 | if (empty($template_name)) { |
||
16 | return false; |
||
17 | } |
||
18 | $template_path = APPPATH . "views/templates/" . $template_name; |
||
19 | $meta_path = $template_path . "/meta.json"; |
||
20 | |||
21 | if (!(is_dir($template_path) && is_file($meta_path))) { |
||
22 | return false; |
||
23 | } |
||
24 | |||
25 | $meta_json = file_get_contents($meta_path); |
||
26 | |||
27 | if (!$meta_json) { |
||
28 | return false; |
||
29 | } |
||
30 | return json_decode($meta_json, true); |
||
31 | } |
||
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.