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.

Throttle   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 11 2
1
<?php
2
/**
3
 * This file is part of the O2System PHP Framework package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @author         Steeve Andrian Salim
9
 * @copyright      Copyright (c) Steeve Andrian Salim
10
 */
11
// ------------------------------------------------------------------------
12
13
namespace App\Http\Middleware;
14
15
// ------------------------------------------------------------------------
16
17
use O2System\Psr\Http\Message\ServerRequestInterface;
18
use O2System\Psr\Http\Server\RequestHandlerInterface;
19
20
/**
21
 * Class Throttle
22
 * @package App\Http\Middleware
23
 */
24
class Throttle implements RequestHandlerInterface
25
{
26
    /**
27
     * Throttle::handle
28
     *
29
     * Handles a request and produces a response
30
     *
31
     * May call other collaborating code to generate the response.
32
     */
33
    public function handle(ServerRequestInterface $request)
34
    {
35
        services()->throttle->request($request);
36
        services()->throttle->rate([
37
            'span' => 1,
38
            'retry' => 10,
39
            'attempts' => 5,
40
        ]);
41
42
        if( ! services()->throttle->verify()) {
43
            output()->sendError(429);
44
        }
45
    }
46
}