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

Middleware   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 2
dl 0
loc 9
rs 10
c 1
b 0
f 0
ccs 0
cts 4
cp 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A wrap() 0 3 1
A __construct() 0 2 1
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