Passed
Branch master (f36b3c)
by Matthew
08:01
created

Connection   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A initialize() 0 6 1
A __construct() 0 3 1
A __call() 0 3 1
1
<?php
2
namespace Fyuze\Database;
3
4
use Fyuze\Database\Drivers\Factory;
5
use Fyuze\Database\Drivers\ConnectionInterface;
6
7
class Connection
8
{
9
    /**
10
     * @var Db
11
     */
12
    protected $database;
13
14
    /**
15
     * @var bool
16
     */
17
    protected $connected = false;
18
19
    /**
20
     * @param array $config
21
     */
22 1
    public function __construct($config)
23
    {
24 1
        $this->initialize($config);
25
    }
26
27
    /**
28
     * @param $config
29
     */
30 1
    protected function initialize($config)
31
    {
32
        /** @var ConnectionInterface $factory */
33 1
        $driver = Factory::create($config);
34
35 1
        $this->database = new Db($driver);
36
    }
37
38
    /**
39
     * @param $method
40
     * @param $params
41
     * @return mixed
42
     */
43 1
    public function __call($method, $params)
44
    {
45 1
        return call_user_func_array([$this->database, $method], $params);
46
    }
47
}
48