| Code Coverage
| Classes and Traits | Functions and Methods | Lines
Total |  |  |  |  |  |  | CRAP | 93.33% covered (success) | 93.33% | 14 / 15
__autoload | 0.00% covered (danger) | 0.00% | 0 / 1 | 0 | 93.33% covered (success) | 93.33% | 14 / 15

1 | <?php
2 |
3 | /**
4 | * Load classes from core directories
5 | * @param string $classname Class to load
6 | * @return file path loaded
7 | **/
8 | function __autoload($className)
9 | {
10 | if (strpos($className, '\\') === false)
11 | return FALSE;
12 | list($namespace, $class) = explode('\\', $className, 2);
13 | $path = null;
14 | switch ($namespace)
15 | {
16 | case "Entity":
17 | $path = "core/models/{$class}.php"; break;
18 | case "Tools":
19 | $path = "core/tools/{$class}.php"; break;
20 | case "Controller":
21 | $path = "core/controllers/{$class}.php"; break;
22 | case "Exception":
23 | $path = "core/exceptions/{$class}.php"; break;
24 | }
25 | if (file_exists($path))
26 | include_once ($path);
27 | return $path;
28 | }
29 |