Passed
Pull Request — master (#94)
by Julien
03:25 queued 51s
created

RestException::setResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Mapado\RestClientSdk\Exception;
6
7
use Psr\Http\Message\ResponseInterface;
8
use Throwable;
9
10
/**
11
 * Class RestException
12
 *
13
 * @author Julien Deniau <[email protected]>
14
 */
15
class RestException extends \RuntimeException
16
{
17
    /**
18
     * @var string
19
     */
20
    private $path;
21
22
    /**
23
     * @var array
24
     */
25
    private $params;
26
27
    /**
28
     * @var ResponseInterface|null
29
     */
30
    private $response;
31
32
    public function __construct(
33
        string $message,
34
        string $path,
35
        array $params = [],
36
        int $code = 0,
37
        ?Throwable $previous = null
38
    ) {
39
        parent::__construct($message, $code, $previous);
40
        $this->path = $path;
41
        $this->params = $params;
42
    }
43
44
    public function getPath(): string
45
    {
46
        return $this->path;
47
    }
48
49
    public function getParams(): array
50
    {
51
        return $this->params;
52
    }
53
54
    public function getResponse(): ?ResponseInterface
55
    {
56
        return $this->response;
57
    }
58
59
    public function setResponse(ResponseInterface $response): void
60
    {
61
        $this->response = $response;
62
    }
63
}
64