Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
17 | 3 | public function __invoke( |
|
18 | ContainerInterface $container, |
||
19 | string $connectionName = self::DEFAULT_CONNECTION_NAME |
||
20 | ): Connection { |
||
21 | 3 | $connectionParams = $container->get('config')['dbal']['connections'][$connectionName] ?? null; |
|
22 | |||
23 | 3 | if (false === is_array($connectionParams)) { |
|
24 | 1 | throw new InvalidArgumentException(self::MISSING_CONFIG_MESSAGE); |
|
25 | } |
||
26 | |||
27 | 2 | return DriverManager::getConnection($connectionParams); |
|
|
|||
28 | } |
||
30 |