TransactionOptimizer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 18
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A prepare() 0 3 1
A finish() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpCfdi\RfcLinc\DataGateway\Pdo;
6
7
use PDO;
8
use PhpCfdi\RfcLinc\DataGateway\OptimizerInterface;
9
10
class TransactionOptimizer implements OptimizerInterface
11
{
12
    /** @var PDO */
13
    private $pdo;
14
15 39
    public function __construct(PDO $pdo)
16
    {
17 39
        $this->pdo = $pdo;
18 39
    }
19
20 2
    public function prepare()
21
    {
22 2
        $this->pdo->beginTransaction();
23 2
    }
24
25 2
    public function finish()
26
    {
27 2
        $this->pdo->commit();
28 2
    }
29
}
30