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.

HttpExceptionsMiddleware   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 27
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A error() 0 11 2
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Middleware\HttpExceptions;
4
5
use ApiClients\Foundation\Middleware\Annotation\ThirdLast;
6
use ApiClients\Foundation\Middleware\MiddlewareInterface;
7
use ApiClients\Foundation\Middleware\PostTrait;
8
use ApiClients\Foundation\Middleware\PreTrait;
9
use ApiClients\Tools\Psr7\HttpStatusExceptions\ExceptionFactory;
10
use Clue\React\Buzz\Message\ResponseException;
11
use React\Promise\CancellablePromiseInterface;
12
use Throwable;
13
use function React\Promise\reject;
14
15
final class HttpExceptionsMiddleware implements MiddlewareInterface
16
{
17
    use PreTrait;
18
    use PostTrait;
19
20
    /**
21
     * When $throwable is a ResponseException this method will turn it into a
22
     * HTTP status code specific exception.
23
     *
24
     * @param Throwable $throwable
25
     * @param array $options
26
     * @return CancellablePromiseInterface
27
     *
28
     * @ThirdLast()
29
     */
30 72
    public function error(
31
        Throwable $throwable,
32
        string $transactionId,
33
        array $options = []
34
    ): CancellablePromiseInterface {
35 72
        if (!($throwable instanceof ResponseException)) {
36 1
            return reject($throwable);
37
        }
38
39 71
        return reject(ExceptionFactory::create($throwable->getResponse(), $throwable));
40
    }
41
}
42