Completed
Pull Request — master (#3513)
by Dimitri
13:34 queued 02:16
created

BacktraceLogger   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 4
dl 0
loc 15
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A startQuery() 0 10 1
1
<?php
2
3
namespace Doctrine\DBAL\Logging;
4
5
use const DEBUG_BACKTRACE_IGNORE_ARGS;
6
use function array_shift;
7
use function debug_backtrace;
8
9
class BacktraceLogger extends DebugStack
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14 27
    public function startQuery($sql, ?array $params = null, ?array $types = null)
15
    {
16 27
        parent::startQuery($sql, $params, $types);
17
18 27
        $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
19
20
        // skip first since it's always the current method
21 27
        array_shift($backtrace);
22
23 27
        $this->queries[$this->currentQuery]['backtrace'] = $backtrace;
24 27
    }
25
}
26