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.

ContextLogger   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 2
A log() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace WyriHaximus\PSR3\ContextLogger;
4
5
use Psr\Log\AbstractLogger;
6
use Psr\Log\LoggerInterface;
7
8
final class ContextLogger extends AbstractLogger
9
{
10
    /**
11
     * @var LoggerInterface
12
     */
13
    private $logger;
14
15
    /**
16
     * @var array
17
     */
18
    private $context;
19
20
    /**
21
     * @var string
22
     */
23
    private $prefix;
24
25
    /**
26
     * @param LoggerInterface $logger
27
     * @param array           $context
28
     * @param string          $prefix
29
     */
30 16
    public function __construct(LoggerInterface $logger, array $context, string $prefix = null)
31
    {
32 16
        $this->logger = $logger;
33 16
        $this->context = $context;
34
35 16
        if ($prefix !== null) {
36 15
            $prefix = '[' . $prefix . '] ';
37
        }
38 16
        $this->prefix = $prefix;
39 16
    }
40
41 15
    public function log($level, $message, array $context = []): void
42
    {
43 15
        $this->logger->log($level, $this->prefix . $message, $this->context + $context);
44 14
    }
45
}
46