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.

LosLog   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 30
rs 10
c 1
b 0
f 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A process() 0 10 2
1
<?php
2
3
namespace LosMiddleware\LosLog;
4
5
use Psr\Http\Message\ResponseInterface;
6
use Psr\Http\Message\ServerRequestInterface;
7
use Psr\Http\Server\MiddlewareInterface;
8
use Psr\Http\Server\RequestHandlerInterface;
9
use Psr\Log\LoggerInterface;
10
11
class LosLog implements MiddlewareInterface
12
{
13
    private $logger;
14
15
    /**
16
     * LosLog constructor.
17
     * @param LoggerInterface $logger
18
     */
19
    public function __construct(LoggerInterface $logger)
20
    {
21
        $this->logger = $logger;
22
    }
23
24
    /**
25
     * @param ServerRequestInterface $request
26
     * @param RequestHandlerInterface $handler
27
     * @return ResponseInterface
28
     * @throws \Throwable
29
     */
30
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
31
    {
32
        try {
33
            return $handler->handle($request);
34
        } catch (\Throwable $error) {
35
            $this->logger->error($error->getMessage() . '. File: ' . $error->getFile() . ':' . $error->getLine());
36
37
            throw $error;
38
        }
39
    }
40
}
41