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

Connection::initialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 1
crap 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