Completed
Push — master ( af310e...ca9412 )
by Nikola
05:51
created

DoctrineDbalExecutor   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 20
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2
ccs 5
cts 5
cp 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace RunOpenCode\Bundle\QueryResourcesLoader\Executor;
6
7
use Doctrine\DBAL\DBALException;
8
use Doctrine\DBAL\Driver\Statement;
9
use RunOpenCode\Bundle\QueryResourcesLoader\Contract\ExecutionResultInterface;
10
use RunOpenCode\Bundle\QueryResourcesLoader\Contract\ExecutorInterface;
11
use Doctrine\DBAL\Connection;
12
13
/**
14
 * Doctrine Dbal query executor.
15
 */
16
final class DoctrineDbalExecutor implements ExecutorInterface
17
{
18
    /**
19
     * @var Connection
20
     */
21
    private Connection $connection;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
22
23 23
    public function __construct(Connection $connection)
24
    {
25 23
        $this->connection = $connection;
26 23
    }
27
28
    /**
29
     * {@inheritdoc}
30
     *
31
     * @throws DBALException
32
     */
33 15
    public function execute(string $query, array $parameters = [], array $types = []): ExecutionResultInterface
34
    {
35
        /** @var Statement<mixed> $statement */
36 15
        $statement = $this->connection->executeQuery($query, $parameters, $types);
37
38 15
        return new DoctrineDbalExecutionResult($statement);
39
    }
40
}
41