improve view generation structure

This commit is contained in:
Dennis Eichhorn 2020-05-02 10:31:57 +02:00
parent cc14586ca3
commit 2c8918904d

View File

@ -161,38 +161,49 @@ final class ApiController extends Controller
foreach ($files as $tMedia) { foreach ($files as $tMedia) {
$lowerPath = \strtolower($tMedia->getPath()); $lowerPath = \strtolower($tMedia->getPath());
if (StringUtils::endsWith($lowerPath, '.lang.php')) { switch ($lowerPath) {
$tcoll['lang'] = $tMedia; case StringUtils::endsWith($lowerPath, '.lang.php'):
} elseif (StringUtils::endsWith($lowerPath, '.cfg.json')) { $tcoll['lang'] = $tMedia;
$tcoll['cfg'] = $tMedia; break;
} elseif (StringUtils::endsWith($lowerPath, '.xlsx.php') case StringUtils::endsWith($lowerPath, '.cfg.json'):
|| StringUtils::endsWith($lowerPath, '.xls.php') $tcoll['cfg'] = $tMedia;
) { break;
$tcoll['excel'][$tMedia->getName()] = $tMedia; case StringUtils::endsWith($lowerPath, '.xlsx.php'):
} elseif (StringUtils::endsWith($lowerPath, '.docx.php') case StringUtils::endsWith($lowerPath, '.xls.php'):
|| StringUtils::endsWith($lowerPath, '.doc.php') $tcoll['excel'][$tMedia->getName()] = $tMedia;
) { break;
$tcoll['word'][$tMedia->getName()] = $tMedia; case StringUtils::endsWith($lowerPath, '.docx.php'):
} elseif (StringUtils::endsWith($lowerPath, '.pptx.php') case StringUtils::endsWith($lowerPath, '.doc.php'):
|| StringUtils::endsWith($lowerPath, '.ppt.php') $tcoll['word'][$tMedia->getName()] = $tMedia;
) { break;
$tcoll['powerpoint'][$tMedia->getName()] = $tMedia; case StringUtils::endsWith($lowerPath, '.pptx.php'):
} elseif (StringUtils::endsWith($lowerPath, '.pdf.php')) { case StringUtils::endsWith($lowerPath, '.ppt.php'):
$tcoll['pdf'][$tMedia->getName()] = $tMedia; $tcoll['powerpoint'][$tMedia->getName()] = $tMedia;
} elseif (StringUtils::endsWith($lowerPath, '.csv.php')) { break;
$tcoll['csv'][$tMedia->getName()] = $tMedia; case StringUtils::endsWith($lowerPath, '.pdf.php'):
} elseif (StringUtils::endsWith($lowerPath, '.json.php')) { $tcoll['pdf'][$tMedia->getName()] = $tMedia;
$tcoll['json'][$tMedia->getName()] = $tMedia; break;
} elseif (StringUtils::endsWith($lowerPath, '.tpl.php')) { case StringUtils::endsWith($lowerPath, '.csv.php'):
$tcoll['template'] = $tMedia; $tcoll['csv'][$tMedia->getName()] = $tMedia;
} elseif (StringUtils::endsWith($lowerPath, '.css')) { break;
$tcoll['css'][$tMedia->getName()] = $tMedia; case StringUtils::endsWith($lowerPath, '.json.php'):
} elseif (StringUtils::endsWith($lowerPath, '.js')) { $tcoll['json'][$tMedia->getName()] = $tMedia;
$tcoll['js'][$tMedia->getName()] = $tMedia; break;
} elseif (StringUtils::endsWith($lowerPath, '.sqlite') || StringUtils::endsWith($lowerPath, '.db')) { case StringUtils::endsWith($lowerPath, '.tpl.php'):
$tcoll['db'][$tMedia->getName()] = $tMedia; $tcoll['template'] = $tMedia;
} else { break;
$tcoll['other'][$tMedia->getName()] = $tMedia; case StringUtils::endsWith($lowerPath, '.css'):
$tcoll['css'][$tMedia->getName()] = $tMedia;
break;
case StringUtils::endsWith($lowerPath, '.js'):
$tcoll['js'][$tMedia->getName()] = $tMedia;
break;
case StringUtils::endsWith($lowerPath, '.sqlite'):
case StringUtils::endsWith($lowerPath, '.db'):
$tcoll['db'][$tMedia->getName()] = $tMedia;
break;
default:
$tcoll['other'][$tMedia->getName()] = $tMedia;
} }
} }