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.

ValidatorMiddleware   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 10
c 2
b 0
f 0
dl 0
loc 32
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 11 3
1
<?php
2
3
namespace TS\PHPValidator;
4
5
use Psr\Http\Message\ResponseInterface;
6
use Psr\Http\Message\ServerRequestInterface as Request;
7
use Psr\Http\Server\RequestHandlerInterface as RequestHandler;
8
9
class ValidatorMiddleware
10
{
11
    /**
12
     * @var Validator Instance
13
     */
14
    protected $validator;
15
16
    /**
17
     * ValidatorMiddleware constructor.
18
     * @param Validator $validator
19
     */
20
    public function __construct(Validator $validator)
21
    {
22
        $this->validator = $validator;
23
    }
24
25
    /**
26
     * @param Request $request
27
     * @param RequestHandler $handler
28
     * @return ResponseInterface
29
     */
30
    public function __invoke(Request $request, RequestHandler $handler): ResponseInterface
31
    {
32
        if (isset($_SESSION['TS_PHPValidator_Errors'])) {
33
            $this->validator->setErrors($_SESSION['TS_PHPValidator_Errors']);
34
            unset($_SESSION['TS_PHPValidator_Errors']);
35
        }
36
        if (isset($_SESSION['TS_PHPValidator_Values'])) {
37
            $this->validator->setValues($_SESSION['TS_PHPValidator_Values']);
38
            unset($_SESSION['TS_PHPValidator_Values']);
39
        }
40
        return $handler->handle($request);
41
    }
42
}