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