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.

RequestFailedException   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 14
c 1
b 0
f 1
dl 0
loc 49
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getHttpResponse() 0 3 1
A getHttpRequest() 0 3 1
A __construct() 0 14 3
1
<?php
2
3
namespace Multicoin\Api\Exceptions;
4
5
use Http\Client\Common\Exception\ClientErrorException;
6
use Psr\Http\Message\RequestInterface;
7
use Psr\Http\Message\ResponseInterface;
8
use Throwable;
9
10
class RequestFailedException extends ClientErrorException
11
{
12
    /**
13
     * @var RequestInterface
14
     */
15
    protected $httpRequest;
0 ignored issues
show
Coding Style introduced by
Protected member variable "httpRequest" must contain a leading underscore
Loading history...
16
    /**
17
     * @var ResponseInterface
18
     */
19
    protected $httpResponse;
0 ignored issues
show
Coding Style introduced by
Protected member variable "httpResponse" must contain a leading underscore
Loading history...
20
21
    /**
22
     * HttpRequestFailedException constructor.
23
     *
24
     * @param  RequestInterface|ResponseInterface  $requestOrResponse
25
     * @param  int  $code
26
     * @param  null|Throwable  $previous
27
     */
28
    public function __construct($requestOrResponse, int $code = 0, Throwable $previous = null)
29
    {
30
        if ($requestOrResponse instanceof ResponseInterface) {
31
            parent::__construct(
32
                'The HTTP request Response failed with the status code '.$requestOrResponse->getStatusCode(),
33
                $requestOrResponse->getRequest(),
0 ignored issues
show
Bug introduced by
The method getRequest() does not exist on Psr\Http\Message\ResponseInterface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
                $requestOrResponse->/** @scrutinizer ignore-call */ 
34
                                    getRequest(),

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
34
                $requestOrResponse->getReasponse(),
0 ignored issues
show
Bug introduced by
The method getReasponse() does not exist on Psr\Http\Message\ResponseInterface. Did you maybe mean getReasonPhrase()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
                $requestOrResponse->/** @scrutinizer ignore-call */ 
35
                                    getReasponse(),

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
35
                $previous
36
            );
37
            $this->httpResponse = $requestOrResponse;
38
        }
39
40
        if ($requestOrResponse instanceof RequestInterface) {
41
            $this->httpRequest = $requestOrResponse;
42
        }
43
    }
44
45
    /**
46
     * @return RequestInterface
47
     */
48
    public function getHttpRequest()
49
    {
50
        return $this->httpRequest;
51
    }
52
53
    /**
54
     * @return ResponseInterface
55
     */
56
    public function getHttpResponse()
57
    {
58
        return $this->httpResponse;
59
    }
60
}
61