Completed
Pull Request — master (#954)
by Dimitri
01:58
created

BacktraceLogger::startQuery()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Doctrine\Bundle\DoctrineBundle\Dbal\Logging;
4
5
use Doctrine\DBAL\Logging\DebugStack;
6
7
final class BacktraceLogger extends DebugStack
8
{
9
    /**
10
     * {@inheritdoc}
11
     */
12
    public function startQuery($sql, ?array $params = null, ?array $types = null) : void
13
    {
14
        parent::startQuery($sql, $params, $types);
15
16
        $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
17
18
        // skip first since it's always the current method
19
        array_shift($backtrace);
20
21
        $this->queries[$this->currentQuery]['backtrace'] = $backtrace;
22
    }
23
}
24