Conditions | 5 |
Paths | 6 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | 228 | public static function create(array $params, Driver $driver) |
|
31 | { |
||
32 | 228 | if (! isset($params['strategy'])) { |
|
33 | 179 | $params['strategy'] = RandomConnector::STRATEGY; |
|
34 | } |
||
35 | |||
36 | 228 | foreach (self::$connectors as $class => $strategy) { |
|
37 | 228 | if ($strategy === $params['strategy'] && is_a($class, Connector::class, true)) { |
|
38 | 227 | return new $class($params, $driver); |
|
39 | } |
||
40 | } |
||
41 | |||
42 | 155 | throw new ConnectorException('No connector for strategy ' . $params['strategy'] . ' found.'); |
|
43 | } |
||
45 |