Failed Conditions
Push — master ( 5f5e96...daf37e )
by Adrien
03:02
created

Middleware::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
ccs 0
cts 1
cp 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ecodev\Felix\DBAL\Logging;
6
7
use Doctrine\DBAL\Driver as DriverInterface;
8
use Doctrine\DBAL\Driver\Middleware as MiddlewareInterface;
9
use Ecodev\Felix\Log\Handler\DbHandler;
10
11
/**
12
 * Log SQL queries including their timing (so the query will be logged after its execution).
13
 */
14
final class Middleware implements MiddlewareInterface
15
{
16
    public function __construct(private readonly DbHandler $dbHandler)
17
    {
18
    }
19
20
    public function wrap(DriverInterface $driver): DriverInterface
21
    {
22
        return new Driver($driver, $this->dbHandler);
23
    }
24
}
25