| Total Complexity | 10 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 3 | class template_model extends Model { |
||
| 4 | |||
| 5 | function get_view_name($template_name) { |
||
| 7 | } |
||
| 8 | |||
| 9 | /** |
||
| 10 | * Load template meta |
||
| 11 | * @param string $template_name Name of template |
||
| 12 | * @return array|false containing meta of template |
||
| 13 | */ |
||
| 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 | } |
||
| 32 | |||
| 33 | function get_template_list() { |
||
| 45 | } |
||
| 46 | |||
| 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.