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
Pull Request — master (#7)
by Bas
03:22
created

LosLog   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
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 20
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
    public function __construct(LoggerInterface $logger)
16
    {
17
        $this->logger = $logger;
18
    }
19
20
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
21
    {
22
        try {
23
            return $handler->handle($request);
24
        } catch (\Throwable $error) {
25
            $this->logger->error($error->getMessage() . '. File: ' . $error->getFile() . ':' . $error->getLine());
26
27
            throw $error;
28
        }
29
    }
30
}
31