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

BacktraceLogger   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 1
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A startQuery() 0 11 1
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