Completed
Pull Request — feature/acceptance-tests (#192)
by
unknown
03:42 queued 02:03
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 PDO;
7
use PDOStatement;
8
9
class Connection
10
{
11
    /**
12
     * @var PDO
13
     */
14
    private $connection;
15
16
    /**
17
     * @param DBALConnection $connection
18
     * @throws \Exception
19
     */
20
    public function __construct(DBALConnection $connection)
21
    {
22
        $conn = $connection->getWrappedConnection();
23
        if (!$conn instanceof PDO) {
24
            throw new \Exception('DBAL Connection should be wrapped around PDO connection');
25
        }
26
27
        $this->connection = $conn;
28
    }
29
30
    /**
31
     * @param string $statement
32
     * @return bool|PDOStatement
33
     */
34
    public function prepare($statement)
35
    {
36
        return $this->connection->prepare($statement);
37
    }
38
}
39