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 ( c33a18...1492ac )
by Cees-Jan
02:57
created

CopyProcessor::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
crap 2
1
<?php declare(strict_types=1);
2
3
namespace WyriHaximus\Monolog\Processors;
4
5
use function igorw\assoc_in;
6
use function igorw\get_in;
7
8
final class CopyProcessor
9
{
10
    /**
11
     * @var string[]
12
     */
13
    private $from;
14
15
    /**
16
     * @var string[]
17
     */
18
    private $to;
19
20
    /**
21
     * @param string $from
22
     * @param string $to
23
     */
24 1
    public function __construct(string $from, string $to)
25
    {
26 1
        $this->from = explode('.', $from);
27 1
        $this->to = explode('.', $to);
28 1
    }
29
30
    /**
31
     * @param  array $record
32
     * @return array
33
     */
34 1
    public function __invoke(array $record)
35
    {
36 1
        $value = get_in($record, $this->from);
37 1
        if ($value !== null) {
38 1
            $record = assoc_in($record, $this->to, $value);
39
        }
40
41 1
        return $record;
42
    }
43
}
44