Completed
Push — master ( 77e4e4...2e1347 )
by Beniamin
05:23
created

PDOConnection::prepare()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 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\QueryBuilder\Connection;
13
14
use Phuria\QueryBuilder\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 1
    public function __construct(\PDO $connection)
30
    {
31 1
        $this->wrappedConnection = $connection;
32 1
    }
33
34
    /**
35
     * @inheritdoc
36
     */
37
    public function query($SQL)
38
    {
39
        $stmt = $this->wrappedConnection->query($SQL);
40
41
        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
}