ConnectionFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
dl 0
loc 14
ccs 7
cts 7
cp 1
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createConnection() 0 12 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Umbrellio\Postgres\Connectors;
6
7
use Illuminate\Database\Connection;
8
use Illuminate\Database\Connectors\ConnectionFactory as ConnectionFactoryBase;
9
use Umbrellio\Postgres\PostgresConnection;
10
11
class ConnectionFactory extends ConnectionFactoryBase
12
{
13 29
    protected function createConnection($driver, $connection, $database, $prefix = '', array $config = [])
14
    {
15 29
        $resolver = Connection::getResolver($driver);
16 29
        if ($resolver) {
17 1
            return $resolver($connection, $database, $prefix, $config);
18
        }
19
20 29
        if ($driver === 'pgsql') {
21 29
            return new PostgresConnection($connection, $database, $prefix, $config);
22
        }
23
24 1
        return parent::createConnection($driver, $connection, $database, $prefix, $config);
25
    }
26
}
27