Completed
Push — master ( edda02...71f62c )
by Beñat
02:05
created

Pdo::beginTransaction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Shared Kernel library.
5
 *
6
 * Copyright (c) 2016-present LIN3S <[email protected]>
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 LIN3S\SharedKernel\Infrastructure\Persistence\Sql;
13
14
final class Pdo
15
{
16
    private $pdo;
17
18
    public function __construct(\PDO $pdo)
19
    {
20
        $this->pdo = $pdo;
21
    }
22
23
    public function exec($statement)
24
    {
25
        return $this->pdo->exec($statement);
26
    }
27
28
    public function beginTransaction()
29
    {
30
        $this->pdo->beginTransaction();
31
    }
32
33
    public function commit()
34
    {
35
        $this->pdo->commit();
36
    }
37
38
    public function rollback()
39
    {
40
        $this->pdo->rollBack();
41
    }
42
43
    public function execute($sql, array $parameters)
44
    {
45
        $statement = $this->pdo->prepare($sql);
46
        $statement->execute($parameters);
47
48
        return $statement;
49
    }
50
}
51