Skip to content

Commit 9cd2540

Browse files
committed
fix(common): refactor imports and improve request handling
- Updated import statements for Request, Response, Navigation, Format, and Sanitize classes to use correct namespace references. - Changed require to require_once for bootstrap.php to avoid multiple inclusions. - Adjusted condition checks for defining constants to use the correct syntax. - Refactored LotgdKernel calls for Request, Response, Navigation, and Sanitize to use the updated class references. - Minor formatting improvements for better readability. ide(config): added/updated automatically. flex(recipe): updated to latest version.
1 parent 72e0fb3 commit 9cd2540

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

public/common_common.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
use Lotgd\Core\Fixed\Theme as LotgdTheme;
1919
use Lotgd\Core\Fixed\Tool as LotgdTool;
2020
use Lotgd\Core\Fixed\Translator as LotgdTranslator;
21+
use Lotgd\Core\Http\Request;
22+
use Lotgd\Core\Http\Response;
23+
use Lotgd\Core\Navigation\Navigation;
24+
use Lotgd\Core\Output\Format;
25+
use Lotgd\Core\Tool\Sanitize;
2126
use MacFJA\Tracy\DoctrineSql;
2227
use Milo\VendorVersions\Panel;
2328
use Tracy\Debugger;
@@ -26,19 +31,19 @@
2631

2732
chdir(realpath(__DIR__ . '/..'));
2833

29-
require \dirname(__DIR__) . '/config/bootstrap.php';
34+
require_once dirname(__DIR__) . '/config/bootstrap.php';
3035
//-- Include constants
3136
require_once 'src/constants.php';
3237

3338
//-- Autoload annotations
3439
AnnotationRegistry::registerLoader(
35-
fn($className) => class_exists($className)
40+
fn($className) => class_exists($className)
3641
);
3742

3843
// Set some constant defaults in case they weren't set before the inclusion of
3944
// common.php
40-
\defined('OVERRIDE_FORCED_NAV') || \define('OVERRIDE_FORCED_NAV', false);
41-
\defined('ALLOW_ANONYMOUS') || \define('ALLOW_ANONYMOUS', false);
45+
defined('OVERRIDE_FORCED_NAV') || define('OVERRIDE_FORCED_NAV', false);
46+
defined('ALLOW_ANONYMOUS') || define('ALLOW_ANONYMOUS', false);
4247

4348
$isDevelopment = 'prod' != $_SERVER['APP_ENV'];
4449
//-- Init Debugger
@@ -87,17 +92,17 @@
8792
//-- Configure Flash Messages
8893
LotgdFlashMessages::instance(LotgdKernel::get('session')->getFlashBag());
8994
//-- Configure format instance
90-
LotgdFormat::instance(LotgdKernel::get(\Lotgd\Core\Output\Format::class));
95+
LotgdFormat::instance(LotgdKernel::get(Format::class));
9196
//-- Configure Request instance
92-
LotgdRequest::instance(LotgdKernel::get(\Lotgd\Core\Http\Request::class));
97+
LotgdRequest::instance(LotgdKernel::get(Request::class));
9398
//-- Configure Response instance
94-
LotgdResponse::instance(LotgdKernel::get(\Lotgd\Core\Http\Response::class));
99+
LotgdResponse::instance(LotgdKernel::get(Response::class));
95100
//-- Configure Navigation instance
96-
LotgdNavigation::instance(LotgdKernel::get(\Lotgd\Core\Navigation\Navigation::class));
101+
LotgdNavigation::instance(LotgdKernel::get(Navigation::class));
97102
//-- Configure Theme template
98103
LotgdTheme::instance(LotgdKernel::get('twig'));
99104
//-- Configure Sanitize instance
100-
LotgdSanitize::instance(LotgdKernel::get(\Lotgd\Core\Tool\Sanitize::class));
105+
LotgdSanitize::instance(LotgdKernel::get(Sanitize::class));
101106
//-- Configure Translator
102107
LotgdTranslator::instance(LotgdKernel::get('translator'));
103108
//-- Configure Event dispatcher instance
@@ -130,6 +135,6 @@
130135
require_once 'lib/lotgd_mail.php';
131136

132137
// Decline static file requests back to the PHP built-in webserver
133-
if ('cli-server' === \PHP_SAPI && is_file(__DIR__ . parse_url(LotgdRequest::getServer('REQUEST_URI'), PHP_URL_PATH))) {
138+
if ('cli-server' === PHP_SAPI && is_file(__DIR__ . parse_url(LotgdRequest::getServer('REQUEST_URI'), PHP_URL_PATH))) {
134139
return false;
135140
}

0 commit comments

Comments
 (0)