From 74ec445a662aa31f713bc50e74c9366da336538a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 6 Dec 2013 14:07:00 +0100 Subject: [PATCH] [change] simplify Tools::getTplFile --- inc/poche/Tools.class.php | 45 ++++++++------------------------------- 1 file changed, 9 insertions(+), 36 deletions(-) diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 9d911699..b0ef55f5 100644 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -88,43 +88,16 @@ class Tools public static function getTplFile($view) { - $default_tpl = 'home.twig'; - - switch ($view) { - case 'install': - $tpl_file = 'install.twig'; - break; - case 'import'; - $tpl_file = 'import.twig'; - break; - case 'export': - $tpl_file = 'export.twig'; - break; - case 'config': - $tpl_file = 'config.twig'; - break; - case 'tags': - $tpl_file = 'tags.twig'; - break; - case 'edit-tags': - $tpl_file = 'edit-tags.twig'; - break; - case 'view': - $tpl_file = 'view.twig'; - break; - case 'login': - $tpl_file = 'login.twig'; - break; - case 'error': - $tpl_file = 'error.twig'; - break; - - default: - $tpl_file = $default_tpl; - break; + $views = array( + 'install', 'import', 'export', 'config', 'tags', + 'edit-tags', 'view', 'login', 'error' + ); + + if (in_array($view, $views)) { + return $view . '.twig'; } - - return $tpl_file; + + return 'home.twig'; } public static function getFile($url) -- 2.41.0