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

ResponseException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 3
crap 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
}