Passed
Push — master ( 7a1811...e7b498 )
by Michael
02:30
created

ResponseException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 66.67%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getResponse() 0 4 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Mikemirten\Component\JsonApi\HttpClient\Exception;
5
6
use Psr\Http\Message\RequestInterface;
7
use Psr\Http\Message\ResponseInterface;
8
9
/**
10
 * Class ResponseException
11
 *
12
 * @package Mikemirten\Component\JsonApi\HttpClient\Exception
13
 */
14
class ResponseException extends RequestException
15
{
16
    /**
17
     * @var ResponseInterface
18
     */
19
    protected $response;
20
21
    /**
22
     * ResponseException constructor.
23
     *
24
     * @param RequestInterface  $request
25
     * @param ResponseInterface $response
26
     * @param \Exception        $previous
27
     */
28 1
    public function __construct(RequestInterface $request, ResponseInterface $response, \Exception $previous)
29
    {
30 1
        parent::__construct($request, $previous);
31
32 1
        $this->response = $response;
33 1
    }
34
35
    /**
36
     * Get response caused the exception
37
     *
38
     * @return ResponseInterface
39
     */
40
    public function getResponse(): ResponseInterface
41
    {
42
        return $this->response;
43
    }
44
}