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
Push — feature/tweak ( 28e05b )
by jake
02:03
created

MessageHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 42
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 12 1
1
<?php
2
/**
3
 * Molniya Messenger
4
 *
5
 * PHP version 5
6
 *
7
 * Copyright (C) 2017 Jake Johns
8
 *
9
 * This software may be modified and distributed under the terms
10
 * of the MIT license.  See the LICENSE file for details.
11
 *
12
 * @category  Middleware
13
 * @package   Jnjxp\Molniya
14
 * @author    Jake Johns <[email protected]>
15
 * @copyright 2017 Jake Johns
16
 * @license   http://jnj.mit-license.org/2017 MIT License
17
 * @link      http://jakejohns.net
18
 */
19
20
namespace Jnjxp\Molniya;
21
22
use Psr\Http\Message\ServerRequestInterface as Request;
23
use Psr\Http\Message\ResponseInterface as Response;
24
25
/**
26
 * MessageHandler
27
 *
28
 * @category Middleware
29
 * @package  Jnjxp\Molniya
30
 * @author   Jake Johns <[email protected]>
31
 * @license  https://jnj.mit-license.org/ MIT License
32
 * @link     https://github.com/
33
 */
34
class MessageHandler
35
{
36
    const MESSAGE_ATTRIBUTE = Messenger\MessengerInterface::class;
37
38
    protected $storage;
39
40
    /**
41
     * __construct
42
     *
43
     * @param StorageInterface $storage DESCRIPTION
44
     *
45
     * @access public
46
     */
47
    public function __construct(StorageInterface $storage)
48
    {
49
        $this->storage = $storage;
50
    }
51
52
    /**
53
     * __invoke
54
     *
55
     * @param Request  $request  DESCRIPTION
56
     * @param Response $response DESCRIPTION
57
     * @param callable $next     DESCRIPTION
58
     *
59
     * @return Response
60
     *
61
     * @access public
62
     */
63
    public function __invoke(
64
        Request $request,
65
        Response $response,
66
        callable $next
67
    ) : Response {
68
69
        $this->storage->read($request);
70
        $messenger = $this->storage->newMessenger($request);
71
        $request   = $request->withAttribute(self::MESSAGE_ATTRIBUTE, $messenger);
72
73
        return $next($request, $response);
74
    }
75
}
76