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.

MessageKeywordFilterLogger   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

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