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.
Passed
Pull Request — master (#216)
by
unknown
04:20
created

ProfileMiddleware::profile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 13
nc 1
nop 0
dl 0
loc 24
rs 9.8333
c 0
b 0
f 0
1
<?php
2
3
namespace EightPoints\Bundle\GuzzleBundle\Middleware;
4
5
use Symfony\Component\Stopwatch\Stopwatch;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Stopwatch\Stopwatch was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
class ProfileMiddleware
8
{
9
    /**
10
     * @var Stopwatch
11
     */
12
    private $stopwatch;
13
14
    /**
15
     * ProfileMiddleware constructor.
16
     * @param Stopwatch $stopwatch
17
     */
18
    public function __construct(Stopwatch $stopwatch)
19
    {
20
        $this->stopwatch = $stopwatch;
21
    }
22
23
    /**
24
     * Logging each Request
25
     *
26
     * @return \Closure
27
     */
28
    public function profile() : \Closure
29
    {
30
        $stopwatch = $this->stopwatch;
31
32
        return function (callable $handler) use ($stopwatch) {
33
34
            return function ($request, array $options) use ($handler, $stopwatch) {
35
                $event = $stopwatch->start(
36
                    sprintf('%s %s', $request->getMethod(), $request->getUri()),
37
                    'eight_points_guzzle'
38
                );
39
40
                return $handler($request, $options)->then(
41
42
                    function ($response) use ($event, $request) {
0 ignored issues
show
Unused Code introduced by
The import $request is not used and could be removed.

This check looks for imports that have been defined, but are not used in the scope.

Loading history...
43
                        $event->stop();
44
45
                        return $response;
46
                    },
47
48
                    function ($reason) use ($event) {
49
                        $event->stop();
50
51
                        return \GuzzleHttp\Promise\rejection_for($reason);
52
                    }
53
                );
54
            };
55
        };
56
    }
57
}
58