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 — master ( 1c7f7f...f34d69 )
by Sebastian
04:18
created

LocalClient   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 8

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 8
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A sendAsync() 0 15 1
1
<?php
2
3
namespace Spatie\Export\Crawler;
4
5
use GuzzleHttp\Client;
6
use Nyholm\Psr7\Factory\Psr17Factory;
7
use Psr\Http\Message\RequestInterface;
8
use GuzzleHttp\Promise\FulfilledPromise;
9
use Illuminate\Http\Request as LaravelRequest;
10
use Illuminate\Contracts\Http\Kernel as HttpKernel;
11
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
12
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
13
14
class LocalClient extends Client
15
{
16
    /** @var \Illuminate\Contracts\Http\Kernel */
17
    protected $kernel;
18
19
    /** @var \Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory */
20
    protected $psrHttpFactory;
21
22
    public function __construct()
23
    {
24
        parent::__construct();
25
26
        $this->kernel = app(HttpKernel::class);
27
28
        $psr17Factory = new Psr17Factory();
29
30
        $this->psrHttpFactory = new PsrHttpFactory($psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory);
31
    }
32
    public function sendAsync(RequestInterface $request, array $options = [])
33
    {
34
        $symfonyRequest = SymfonyRequest::create(
35
            (string) $request->getUri(),
36
            $request->getMethod()
37
        );
38
39
        $response = $this->kernel->handle(
40
            LaravelRequest::createFromBase($symfonyRequest)
41
        );
42
43
        $psrResponse = $this->psrHttpFactory->createResponse($response);
44
45
        return new FulfilledPromise($psrResponse);
46
    }
47
}
48