Completed
Pull Request — develop (#3584)
by Gabriel
66:08 queued 01:47
created

LoggerChain   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
eloc 7
dl 0
loc 30
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A startQuery() 0 4 2
A stopQuery() 0 4 2
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\DBAL\Logging;
6
7
/**
8
 * Chains multiple SQLLogger.
9
 */
10
final class LoggerChain implements SQLLogger
11
{
12
    /** @var iterable<SQLLogger> */
13
    private $loggers = [];
14
15
    /**
16
     * @param iterable<SQLLogger> $loggers
17
     */
18
    public function __construct(iterable $loggers = [])
19
    {
20
        $this->loggers = $loggers;
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function startQuery(string $sql, array $params = [], array $types = []) : void
27
    {
28
        foreach ($this->loggers as $logger) {
29
            $logger->startQuery($sql, $params, $types);
30
        }
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function stopQuery() : void
37
    {
38
        foreach ($this->loggers as $logger) {
39
            $logger->stopQuery();
40
        }
41
    }
42
}
43