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.

FormattedPsrHandler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 90.91%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 2
b 0
f 0
dl 0
loc 23
ccs 10
cts 11
cp 0.9091
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A write() 0 14 2
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WyriHaximus\Monolog\FormattedPsrHandler;
6
7
use Monolog\Handler\AbstractProcessingHandler;
8
use Monolog\Level;
9
use Monolog\LogRecord;
10
use Psr\Log\LoggerInterface;
11
use WyriHaximus\PSR3\Utils;
0 ignored issues
show
Bug introduced by
The type WyriHaximus\PSR3\Utils was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
13 2
use function strtolower;
14
15 2
final class FormattedPsrHandler extends AbstractProcessingHandler
16
{
17 2
    /** @phpstan-ignore-next-line */
18 2
    public function __construct(protected LoggerInterface $logger, int|string|Level $level = Level::Debug, bool $bubble = true)
19
    {
20
        /** @psalm-suppress ArgumentTypeCoercion */
21
        parent::__construct($level, $bubble);
22
    }
23 2
24
    protected function write(LogRecord $record): void
25 2
    {
26
        /** @psalm-suppress InvalidArgument */
27
        if (! $this->isHandling($record)) {
28
            // @codeCoverageIgnoreStart
29 2
            return; // This is tested in FormattedPsrHandlerTest::notHandled but not picked up by PHPUnit as covered
30 2
31 2
            // @codeCoverageIgnoreEnd
32 2
        }
33
34 2
        $this->logger->log(
35
            strtolower($record->level->name),
0 ignored issues
show
Bug introduced by
The property name does not seem to exist on Monolog\Level.
Loading history...
36
            Utils::formatValue($record->formatted ?? $record->message),
37
            $record->context,
38
        );
39
    }
40
}
41