1 | <?php |
||
7 | class ClassLoader |
||
8 | { |
||
9 | /** |
||
10 | * @var static |
||
11 | */ |
||
12 | protected static $instance; |
||
13 | |||
14 | /** |
||
15 | * @param array $addons |
||
16 | */ |
||
17 | 2 | public static function register(AddonEnvironment $env, $addons) |
|
18 | { |
||
19 | 2 | static::$instance = new static($env, $addons); |
|
20 | |||
21 | // TODO check addon configuration |
||
22 | |||
23 | 2 | spl_autoload_register([static::$instance, 'load'], true, false); |
|
24 | 2 | } |
|
25 | |||
26 | /** |
||
27 | */ |
||
28 | 1 | public static function unregister() |
|
29 | { |
||
30 | 1 | if (static::$instance) { |
|
31 | 1 | spl_autoload_unregister([static::$instance, 'load']); |
|
32 | 1 | } |
|
33 | 1 | } |
|
34 | |||
35 | protected $env; |
||
36 | |||
37 | protected $addons; |
||
38 | |||
39 | /** |
||
40 | * @param Jumilla\Addomnipot\Laravel\Environment $env |
||
41 | * @param array $addons |
||
42 | */ |
||
43 | 3 | public function __construct(AddonEnvironment $env, array $addons) |
|
48 | |||
49 | /** |
||
50 | * @param string $className |
||
51 | * |
||
52 | * @return bool |
||
53 | */ |
||
54 | 1 | public function load($className) |
|
85 | } |
||
86 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.