Completed
Pull Request — master (#17)
by
unknown
01:31
created

PreparedQueryExtractor::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 10
nc 2
nop 3
1
<?php
2
3
namespace Extraload\Extractor\Doctrine;
4
5
use Doctrine\DBAL\Connection;
6
use Extraload\Extractor\Doctrine\AbstractExtractor;
7
8
class PreparedQueryExtractor extends AbstractExtractor
9
{
10
    public function __construct(Connection $conn, string $sql, array $values)
11
    {
12
        $this->stmt = $conn->prepare($sql);
13
        foreach ($values as $value) {
14
            $this->stmt->bindValue(
15
                $value['parameter'],
16
                $value['value'],
17
                $value['data_type'] ?? null
18
            );
19
        }
20
        $this->stmt->execute();
21
22
        $this->position = 0;
23
24
        $this->data = [];
25
    }
26
}
27