NoDbNameConnectionFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 6
dl 0
loc 11
rs 10
c 1
b 0
f 0
ccs 5
cts 5
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Shlinkio\Shlink\Common\Doctrine;
6
7
use Doctrine\DBAL\Connection;
8
use Psr\Container\ContainerInterface;
9
10
class NoDbNameConnectionFactory
11
{
12
    public const SERVICE_NAME = 'Shlinkio\Shlink\Common\Doctrine\NoDbNameConnection';
13
14 1
    public function __invoke(ContainerInterface $container): Connection
15
    {
16 1
        $conn = $container->get(Connection::class);
17 1
        $params = $conn->getParams();
18 1
        unset($params['dbname']);
19
20 1
        return new Connection($params, $conn->getDriver(), $conn->getConfiguration(), $conn->getEventManager());
21
    }
22
}
23