GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

BasicBacktraceReporter   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 95.24%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
c 3
b 1
f 0
dl 0
loc 54
wmc 8
lcom 1
cbo 0
ccs 20
cts 21
cp 0.9524
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setBacktraceLimit() 0 4 1
A getBacktraceLimit() 0 4 1
B getBacktrace() 0 22 6
1
<?php
2
3
namespace Camspiers\LoggerBridge\BacktraceReporter;
4
5
/**
6
 * Class BasicBacktraceReporter
7
 */
8
class BasicBacktraceReporter implements BacktraceReporter
9
{
10
    /**
11
     * Backtrace limit. Defaults to 0
12
     * @var int
13
     */
14
    protected $backtraceLimit = 0;
15
16
    /**
17
     * Sets the limit on the number of backtrace calls shown
18
     * @param int $backtraceLimit
19
     */
20 2
    public function setBacktraceLimit($backtraceLimit)
21
    {
22 2
        $this->backtraceLimit = (int) $backtraceLimit;
23 2
    }
24
25
    /**
26
     * Returns the backtrace limit
27
     * @return int
28
     */
29 1
    public function getBacktraceLimit()
30
    {
31 1
        return $this->backtraceLimit;
32
    }
33
34
    /**
35
     * Returns a basic backtrace
36
     * @param  \Exception $exception
37
     * @return array
38
     */
39 5
    public function getBacktrace(\Exception $exception = null)
40
    {
41 5
        $skipLimit = false;
42
43 5
        if ($exception instanceof \Exception) {
44 3
            $backtrace = $exception->getTrace();
45 3
            foreach ($backtrace as $index => $backtraceCall) {
46 3
                unset($backtrace[$index]['args']);
47 3
            }
48 5
        } elseif (version_compare(PHP_VERSION, '5.4.0') >= 0) {
49 2
            $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $this->backtraceLimit);
50 2
            $skipLimit = true;
51 2
        } else {
52
            $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
53
        }
54
55 5
        if ($this->backtraceLimit > 0 && !$skipLimit) {
56 1
            $backtrace = array_slice($backtrace, 0, $this->backtraceLimit);
57 1
        }
58
59 5
        return $backtrace;
60
    }
61
}
62