Conditions | 4 |
Paths | 4 |
Total Lines | 38 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
8 | function netBazzlineComponentRequirementDevelopmentAutoloader($className) |
||
9 | { |
||
10 | $namespace = 'Net\\Bazzline\\Component\\Requirement\\'; |
||
11 | $lengthOfNamespace = strlen($namespace); |
||
12 | $expectedNamespace = substr($className, 0, $lengthOfNamespace); |
||
13 | |||
14 | $isSupportedClassnameByNamespace = ($namespace == $expectedNamespace); |
||
15 | |||
16 | if ($isSupportedClassnameByNamespace) { |
||
17 | $classNameWithRemovedNamespace = str_replace($namespace, '', $className); |
||
18 | $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $classNameWithRemovedNamespace) . '.php'; |
||
19 | $includePaths = array( |
||
20 | realpath(__DIR__ . DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR |
||
21 | ); |
||
22 | |||
23 | foreach ($includePaths as $includePath) { |
||
24 | $filePath = realpath($includePath . DIRECTORY_SEPARATOR . $fileName); |
||
25 | |||
26 | if (file_exists($filePath)) { |
||
27 | require $filePath; |
||
28 | |||
29 | break; |
||
30 | } else { |
||
31 | echo var_export( |
||
32 | array( |
||
33 | 'classname' => $className, |
||
34 | 'filename' => $fileName, |
||
35 | 'filepath' => $filePath, |
||
36 | 'includedPath' => $includePath |
||
37 | ), |
||
38 | true |
||
39 | ) . PHP_EOL; |
||
40 | } |
||
41 | } |
||
42 | } else { |
||
43 | return false; |
||
44 | } |
||
45 | } |
||
46 | |||
48 |