File tree Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Original file line number Diff line number Diff line change 20
20
},
21
21
"autoload" : {
22
22
"psr-0" : {
23
- "PHPFUI" : " src/" ,
24
- "badPHP" : " tests/"
23
+ "PHPFUI" : " src/"
25
24
}
26
25
}
27
26
}
Original file line number Diff line number Diff line change 1
1
<?php
2
-
3
2
error_reporting (E_ALL );
4
3
5
- $ vendorDir = __DIR__ . '/../../vendor ' ;
4
+ function classNameExists (string $ className ) : string
5
+ {
6
+ $ path = __DIR__ . "/ {$ className }.php " ;
7
+ $ path = str_replace ('\\' , '/ ' , $ path );
8
+ return file_exists ($ path ) ? $ path : '' ;
9
+ }
10
+
11
+ function autoload ($ className ) : void
12
+ {
13
+ $ path = classNameExists ($ className );
14
+
15
+ if ($ path )
16
+ {
17
+ /** @noinspection PhpIncludeInspection */
18
+ include $ path ;
19
+ }
20
+ }
21
+ spl_autoload_register ('autoload ' );
6
22
7
- if (file_exists ($ file = $ vendorDir . '/autoload.php ' )) {
8
- require_once $ file ;
9
- } elseif (file_exists ($ file = './vendor/autoload.php ' )) {
10
- require_once $ file ;
11
- } else {
12
- throw new \RuntimeException ('Composer autoload file not found ' );
13
- }
23
+ require_once 'vendor/autoload.php ' ;
You can’t perform that action at this time.
0 commit comments