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.
Completed
Push — master ( 432e51...3131c6 )
by Cees-Jan
01:55
created

TraceProcessor   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 92.31%

Importance

Changes 0
Metric Value
wmc 8
lcom 0
cbo 0
dl 0
loc 39
ccs 12
cts 13
cp 0.9231
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
B __invoke() 0 19 7
1
<?php declare(strict_types=1);
2
3
namespace WyriHaximus\Monolog\Processors;
4
5
use Throwable;
6
7
final class TraceProcessor
8
{
9
    /**
10
     * @var bool
11
     */
12
    private $always = false;
13
14
    /**
15
     * @param bool $always
16
     */
17 3
    public function __construct(bool $always = false)
18
    {
19 3
        $this->always = $always;
20 3
    }
21
22
    /**
23
     * @param  array $record
24
     * @return array
25
     */
26 3
    public function __invoke(array $record)
27
    {
28 3
        if (isset($record['context']['exception']) && $record['context']['exception'] instanceof Throwable) {
29 1
            $record['extra']['trace'] = $record['context']['exception']->getTrace();
30 1
            foreach ($record['extra']['trace'] as $index => $line) {
31 1
                if (!isset($line['args'])) {
32
                    continue;
33
                }
34
35 1
                unset($record['extra']['trace'][$index]['args']);
36
            }
37
        }
38
39 3
        if ($this->always && !isset($record['extra']['trace'])) {
40 1
            $record['extra']['trace'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
41
        }
42
43 3
        return $record;
44
    }
45
}
46