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

Mysql::open()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
namespace Fyuze\Database\Drivers;
3
4
use PDO;
5
6
class Mysql extends Driver
7
{
8
    /**
9
     * @param $config
10
     */
11 2
    public function __construct($config)
12
    {
13 2
        $this->config = $config;
14
    }
15
16
    /**
17
     * @codeCoverageIgnore
18
     */
19
    public function open()
20
    {
21
        return new PDO($this->getDsn(), $this->config['username'], $this->config['password'], $this->getOptions());
22
    }
23
24
    /**
25
     * @return string
26
     */
27 1
    protected function getDsn()
28
    {
29 1
        return sprintf('mysql:host=%s;dbname=%s', $this->config['host'], $this->config['database']);
30
    }
31
}
32