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

Driver::getOptions()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 7
ccs 6
cts 6
cp 1
rs 10
cc 3
nc 4
nop 0
crap 3
1
<?php
2
namespace Fyuze\Database\Drivers;
3
4
use PDO;
5
6
abstract class Driver implements ConnectionInterface
7
{
8
    /**
9
     * @var array
10
     */
11
    protected $config;
12
13
    /**
14
     * @return array
15
     */
16 6
    protected function getOptions()
17
    {
18 6
        return [
19 6
            PDO::ATTR_PERSISTENT => array_key_exists('persistent', $this->config) ? $this->config['persistent'] : false,
20 6
            PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
21 6
            PDO::ATTR_DEFAULT_FETCH_MODE => array_key_exists('fetch', $this->config)
22 6
                ? constant($this->config['fetch']) : PDO::FETCH_OBJ
23 6
        ];
24
    }
25
}
26