Clean code
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
class AssetController extends BaseController
|
||||
class AssetController
|
||||
{
|
||||
private const ALLOWED = [
|
||||
'app.css' => 'text/css',
|
||||
@@ -11,13 +11,15 @@ class AssetController extends BaseController
|
||||
|
||||
public function serve(): void
|
||||
{
|
||||
$file = basename((string) $this->f3->get('PARAMS.file'));
|
||||
$f3 = Base::instance();
|
||||
$file = basename((string) $f3->get('PARAMS.file'));
|
||||
|
||||
if (!array_key_exists($file, self::ALLOWED)) {
|
||||
$this->f3->error(404);
|
||||
$f3->error(404);
|
||||
return;
|
||||
}
|
||||
|
||||
$f3->expire(86400);
|
||||
echo Web::instance()->minify(
|
||||
$file,
|
||||
self::ALLOWED[$file],
|
||||
|
||||
Reference in New Issue
Block a user