@@ -12,33 +12,33 @@ |
||
| 12 | 12 | * @return void |
| 13 | 13 | */ |
| 14 | 14 | spl_autoload_register( |
| 15 | - function ($class) { |
|
| 15 | + function ($class) { |
|
| 16 | 16 | |
| 17 | - // project-specific namespace prefix |
|
| 18 | - //$prefix = 'Foo\\Bar\\'; |
|
| 19 | - $prefix = 'helikopterspark\\'; |
|
| 17 | + // project-specific namespace prefix |
|
| 18 | + //$prefix = 'Foo\\Bar\\'; |
|
| 19 | + $prefix = 'helikopterspark\\'; |
|
| 20 | 20 | |
| 21 | - // base directory for the namespace prefix |
|
| 22 | - $base_dir = __DIR__ . '/src/'; |
|
| 21 | + // base directory for the namespace prefix |
|
| 22 | + $base_dir = __DIR__ . '/src/'; |
|
| 23 | 23 | |
| 24 | - // does the class use the namespace prefix? |
|
| 25 | - $len = strlen($prefix); |
|
| 26 | - if (strncmp($prefix, $class, $len) !== 0) { |
|
| 27 | - // no, move to the next registered autoloader |
|
| 28 | - return; |
|
| 29 | - } |
|
| 24 | + // does the class use the namespace prefix? |
|
| 25 | + $len = strlen($prefix); |
|
| 26 | + if (strncmp($prefix, $class, $len) !== 0) { |
|
| 27 | + // no, move to the next registered autoloader |
|
| 28 | + return; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - // get the relative class name |
|
| 32 | - $relative_class = substr($class, $len); |
|
| 31 | + // get the relative class name |
|
| 32 | + $relative_class = substr($class, $len); |
|
| 33 | 33 | |
| 34 | - // replace the namespace prefix with the base directory, replace namespace |
|
| 35 | - // separators with directory separators in the relative class name, append |
|
| 36 | - // with .php |
|
| 37 | - $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
| 34 | + // replace the namespace prefix with the base directory, replace namespace |
|
| 35 | + // separators with directory separators in the relative class name, append |
|
| 36 | + // with .php |
|
| 37 | + $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
| 38 | 38 | |
| 39 | - // if the file exists, require it |
|
| 40 | - if (file_exists($file)) { |
|
| 41 | - include $file; |
|
| 42 | - } |
|
| 43 | - } |
|
| 39 | + // if the file exists, require it |
|
| 40 | + if (file_exists($file)) { |
|
| 41 | + include $file; |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | 44 | ); |