DbDriverFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A factory() 0 7 1
1
<?php
2
/**
3
 * Database driver factory
4
 *
5
 * @author    Matthias Gisder <[email protected]>
6
 * @copyright 2014 inGenerator Ltd
7
 * @licence   BSD
8
 */
9
10
11
namespace Ingenerator\RunSingle;
12
13
use \Ingenerator\RunSingle\PdoDatabaseObject;
14
15
class DbDriverFactory
16
{
17
    /**
18
     * @param string[] $credentials
19
     *
20
     * @return DbDriver
21
     */
22
    public static function factory($credentials)
23
    {
24
        $pdo       = new \PDO($credentials['dsn'], $credentials['db_user'], $credentials['db_pass']);
25
        $db_object = new PdoDatabaseObject($pdo, $credentials['db_table_name']);
26
27
        return new DbDriver($db_object);
28
    }
29
30
}
31