Issues (99)

src/Loader/ClassMap.php (1 issue)

Severity
1
<?php
2
/**
3
 * DronePHP (http://www.dronephp.com)
4
 *
5
 * @link      http://github.com/Pleets/DronePHP
6
 * @copyright Copyright (c) 2016-2018 Pleets. (http://www.pleets.org)
7
 * @license   http://www.dronephp.com/license
8
 * @author    Darío Rivera <[email protected]>
9
 */
10
11
namespace Drone\Loader;
12
13
/**
14
 * AbstractModule class
15
 *
16
 * This class is an autoloader
17
 */
18
class ClassMap
19
{
20
    /**
21
     * The class path
22
     *
23
     * @var string
24
     */
25
    public static $path;
26
27
    /**
28
     * Creates an autoloader for module classes
29
     *
30
     * @param string $name
31
     * @param string $path
32
     *
33
     * @return null
34
     */
35 2
    public static function autoload($name)
36
    {
37 2
        $nm = explode('\\', $name);
38 2
        $module = array_shift($nm);
39
40 2
        $path = is_null(self::$path) ? '' : self::$path . DIRECTORY_SEPARATOR;
0 ignored issues
show
The condition is_null(self::path) is always false.
Loading history...
41
42 2
        $class = $path . implode(DIRECTORY_SEPARATOR, $nm) . ".php";
43
44 2
        if (file_exists($class)) {
45 1
            include $class;
46
        }
47 2
    }
48
}
49