fadrian06 12 months ago
parent db02086d21
commit afba9c16a0

@ -28,8 +28,7 @@
},
"autoload": {
"files": [
"flight/autoload.php",
"flight/Flight.php"
"flight/autoload.php"
]
},
"autoload-dev": {

@ -10,6 +10,8 @@ use flight\net\Router;
use flight\template\View;
use flight\net\Route;
require_once __DIR__ . '/autoload.php';
/**
* The Flight class is a static representation of the framework.
*

@ -4,6 +4,7 @@ declare(strict_types=1);
use flight\core\Loader;
require_once __DIR__ . '/Flight.php';
require_once __DIR__ . '/core/Loader.php';
Loader::autoload(true, [dirname(__DIR__)]);

@ -190,12 +190,13 @@ class Loader
*/
public static function loadClass(string $class): void
{
$class_file = str_replace(['\\', '_'], '/', $class) . '.php';
$classFile = str_replace(['\\', '_'], '/', $class) . '.php';
foreach (self::$dirs as $dir) {
$file = $dir . '/' . $class_file;
if (file_exists($file)) {
require $file;
$filePath = "$dir/$classFile";
if (file_exists($filePath)) {
require_once $filePath;
return;
}

@ -1,6 +1,7 @@
<?php
require 'flight/Flight.php';
// require 'flight/Flight.php';
require 'flight/autoload.php';
Flight::route('/', function () {
echo 'hello world!';

@ -36,6 +36,8 @@
<exclude name="Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition" />
<exclude name="Generic.Commenting.DocComment.MissingShort" />
<exclude name="Generic.Commenting.DocComment.SpacingBeforeTags" />
<exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceAfterOpen" />
<exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceBeforeClose" />
</rule>
<file>flight/</file>
<file>tests/</file>

Loading…
Cancel
Save