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::getBacktraceLimit()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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