Completed
Push — bugfix/remove-usage-of-mopa-bo... ( dec083...82d2d0 )
by
unknown
01:57
created

Connection   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
A prepare() 0 4 1
1
<?php
2
3
namespace Surfnet\StepupGateway\Behat\Repository;
4
5
use Doctrine\DBAL\Connection as DBALConnection;
6
use Exception;
7
use PDO;
8
use PDOStatement;
9
10
class Connection
11
{
12
    /**
13
     * @var PDO
14
     */
15
    private $connection;
16
17
    /**
18
     * @param DBALConnection $connection
19
     * @throws Exception
20
     */
21
    public function __construct(DBALConnection $connection)
22
    {
23
        $conn = $connection->getWrappedConnection();
24
        if (!$conn instanceof PDO) {
25
            throw new Exception('DBAL Connection should be wrapped around PDO connection');
26
        }
27
28
        $this->connection = $conn;
29
    }
30
31
    /**
32
     * @param string $statement
33
     * @return bool|PDOStatement
34
     */
35
    public function prepare($statement)
36
    {
37
        return $this->connection->prepare($statement);
38
    }
39
}
40