Completed
Push — master ( f1bafc...dbcbc1 )
by Sébastien
03:15
created

PdoSqliteAdapter::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 0
cts 8
cp 0
rs 9.4286
cc 2
eloc 5
nc 2
nop 1
crap 6
1
<?php
2
3
namespace Soluble\DbWrapper\Adapter;
4
5
use Soluble\DbWrapper\Exception;
6
use Soluble\DbWrapper\Adapter\Pdo\GenericPdo;
7
use PDO;
8
9
class PdoSqliteAdapter extends GenericPdo implements AdapterInterface
10
{
11
12
    /**
13
     *
14
     * @var \PDO
15
     */
16
    protected $resource;
17
18
19
    /**
20
     * Constructor
21
     *
22
     * @throws Exception\InvalidArgumentException
23
     * @param \PDO $connection
24
     */
25
    public function __construct(PDO $connection)
26
    {
27
        if ($connection->getAttribute(\PDO::ATTR_DRIVER_NAME) != 'sqlite') {
28
            $msg = __CLASS__ . " requires pdo connection to be 'sqlite'";
29
            throw new Exception\InvalidArgumentException($msg);
30
        }
31
        $this->resource = $connection;
32
    }
33
    
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function getCurrentSchema() 
38
    {
39
        throw new \Exception('nope');
40
    }
41
}
42