Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 2 |
CRAP Score | 6.7968 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | function PSFSAutoloader($class): false |
||
16 | { |
||
17 | // it only autoload class into the Rain scope |
||
18 | 4 | if (str_contains($class, 'PSFS')) { |
|
19 | // Change order src |
||
20 | $class = preg_replace('/^\\\\?PSFS/', '', $class); |
||
21 | // transform the namespace in path |
||
22 | $path = str_replace("\\", DIRECTORY_SEPARATOR, $class); |
||
23 | // filepath |
||
24 | $abs_path = SOURCE_DIR . DIRECTORY_SEPARATOR . $path . ".php"; |
||
25 | // require the file |
||
26 | if (file_exists($abs_path)) { |
||
27 | require_once $abs_path; |
||
28 | } else { |
||
29 | Logger::log("{$class} not loaded with " . __FILE__); |
||
30 | } |
||
31 | } |
||
32 | 4 | return false; |
|
33 | } |
||
38 |