Conditions | 2 |
Paths | 1 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
39 | 2 | protected static function build( $connection ) { |
|
40 | 2 | $connections = static::connections(); |
|
41 | |||
42 | 2 | if ( empty( $connections[ $connection ] ) ) { |
|
43 | 1 | throw new ConnectionNotFoundException(); |
|
44 | } |
||
45 | |||
46 | 1 | static::$instances[ $connection ] = new Queue( $connections[ $connection ], $connection ); |
|
47 | |||
48 | 1 | return static::$instances[ $connection ]; |
|
49 | } |
||
64 | } |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: