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

PreparedQueryExtractor   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 2
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
}
25