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

BacktraceLogger::startQuery()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 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