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

DHDriver::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
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\Connection as DBALConnection;
8
use Doctrine\DBAL\Driver\API\ExceptionConverter;
9
use Doctrine\DBAL\Driver as DriverInterface;
10
use Doctrine\DBAL\Platforms\AbstractPlatform;
11
use Doctrine\DBAL\Schema\AbstractSchemaManager;
12
13
/**
14
 * @interal
15
 */
16
final class DHDriver implements DriverInterface
17
{
18
    private DriverInterface $driver;
19
20
    /** @var array<callable> */
21
    private array $flusherList = [];
22
23
    /**
24
     * @internal this driver can be only instantiated by its middleware
25
     */
26
    public function __construct(DriverInterface $driver)
27
    {
28
        $this->driver = $driver;
29
    }
30
31
    /**
32
     * {@inheritDoc}
33
     */
34
    public function connect(array $params)
35
    {
36
        return new DHConnection(
37
            $this->driver->connect($params),
38
            $this
39
        );
40
    }
41
42
    /**
43
     * {@inheritDoc}
44
     */
45
    public function getDatabasePlatform(): AbstractPlatform
46
    {
47
        return $this->driver->getDatabasePlatform();
48
    }
49
50
    /**
51
     * {@inheritDoc}
52
     */
53
    public function getSchemaManager(DBALConnection $conn, AbstractPlatform $platform): AbstractSchemaManager
54
    {
55
        return $this->driver->getSchemaManager($conn, $platform);
0 ignored issues
show
Deprecated Code introduced by
The function Doctrine\DBAL\Driver::getSchemaManager() has been deprecated: Use {@link AbstractPlatform::createSchemaManager()} instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

55
        return /** @scrutinizer ignore-deprecated */ $this->driver->getSchemaManager($conn, $platform);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
56
    }
57
58
    public function getExceptionConverter(): ExceptionConverter
59
    {
60
        return $this->driver->getExceptionConverter();
61
    }
62
63
    public function addDHFlusher(callable $flusher): void
64
    {
65
        $this->flusherList[] = $flusher;
66
    }
67
68
    public function resetDHFlusherList(): void
69
    {
70
        $this->flusherList = [];
71
    }
72
73
    public function getFlusherList(): array
74
    {
75
        return $this->flusherList;
76
    }
77
}
78