Completed
Push — master ( 375486...00a9d7 )
by Beniamin
02:41
created

PDOConnection   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 35
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A prepare() 0 6 1
A query() 0 6 1
1
<?php
2
3
/**
4
 * This file is part of Phuria SQL Builder package.
5
 *
6
 * Copyright (c) 2016 Beniamin Jonatan Šimko
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Phuria\SQLBuilder\Connection;
13
14
use Phuria\SQLBuilder\Statement\PDOStatement;
15
16
/**
17
 * @author Beniamin Jonatan Šimko <[email protected]>
18
 */
19
class PDOConnection implements ConnectionInterface
20
{
21
    /**
22
     * @var \PDO $wrappedConnection
23
     */
24
    private $wrappedConnection;
25
26
    /**
27
     * @param \PDO $connection
28
     */
29 2
    public function __construct(\PDO $connection)
30
    {
31 2
        $this->wrappedConnection = $connection;
32 2
    }
33
34
    /**
35
     * @inheritdoc
36
     */
37 1
    public function query($SQL)
38
    {
39 1
        $stmt = $this->wrappedConnection->query($SQL);
40
41 1
        return new PDOStatement($stmt);
42
    }
43
44
    /**
45
     * @inheritdoc
46
     */
47 1
    public function prepare($SQL)
48
    {
49 1
        $stmt = $this->wrappedConnection->prepare($SQL);
50
51 1
        return new PDOStatement($stmt);
52
    }
53
}