Passed
Pull Request — master (#123)
by
unknown
02:07
created

DHDriver::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DH\Auditor\Provider\Doctrine\Auditing\Logger\Middleware;
6
7
use Doctrine\DBAL\Driver as DriverInterface;
8
use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware;
9
10
/**
11
 * @interal
12
 */
13
final class DHDriver extends AbstractDriverMiddleware
14
{
15
    private DriverInterface $driver;
16
17
    /** @var array<callable> */
18
    private array $flusherList = [];
19
20
    public function __construct(DriverInterface $driver)
21
    {
22
        parent::__construct($driver);
23
        $this->driver = $driver;
24
    }
25
26
    /**
27
     * {@inheritDoc}
28
     */
29
    public function connect(array $params)
30
    {
31
        return new DHConnection(
32
            $this->driver->connect($params),
33
            $this
34
        );
35
    }
36
37
    public function addDHFlusher(callable $flusher): void
38
    {
39
        $this->flusherList[] = $flusher;
40
    }
41
42
    public function resetDHFlusherList(): void
43
    {
44
        $this->flusherList = [];
45
    }
46
47
    public function getFlusherList(): array
48
    {
49
        return $this->flusherList;
50
    }
51
}
52