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   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 36
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A __invoke() 0 9 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