ConnectionFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 80%

Importance

Changes 5
Bugs 1 Features 0
Metric Value
wmc 3
c 5
b 1
f 0
lcom 0
cbo 3
dl 0
loc 27
ccs 4
cts 5
cp 0.8
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createConnection() 0 12 3
1
<?php namespace Bosnadev\Database\Connectors;
2
3
use Bosnadev\Database\PostgresConnection;
4
5
/**
6
 * Class ConnectionFactory
7
 * @package Bosnadev\Database\Connectors
8
 */
9
class ConnectionFactory extends \Illuminate\Database\Connectors\ConnectionFactory
10
{
11
    /**
12
     * Create a new connection instance.
13
     *
14
     * @param  string   $driver
15
     * @param  \PDO|\Closure     $connection
16
     * @param  string   $database
17
     * @param  string   $prefix
18
     * @param  array    $config
19
     * @return \Illuminate\Database\Connection
20
     *
21
     * @throws \InvalidArgumentException
22
     */
23
    protected function createConnection($driver, $connection, $database, $prefix = '', array $config = array())
24
    {
25
        if ($this->container->bound($key = "db.connection.{$driver}")) {
26
            return $this->container->make($key, array($connection, $database, $prefix, $config));
27 3
        }
28
29 3
        if ($driver === 'pgsql') {
30
            return new PostgresConnection($connection, $database, $prefix, $config);
31
        }
32
33 3
        return parent::createConnection($driver, $connection, $database, $prefix, $config);
34 3
    }
35
}
36