ResponseException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 6
ccs 0
cts 5
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Personnage\Tinkoff\SDK\Exception;
4
5
use Personnage\Tinkoff\SDK\Response\Response;
6
7
class ResponseException extends \RuntimeException implements TinkoffSDKException
8
{
9
    /**
10
     * @var Response
11
     */
12
    private $response;
13
14
    public function __construct(Response $response)
15
    {
16
        parent::__construct($response->getErrorMessage(), $response->getErrorCode());
17
18
        $this->response = $response;
19
    }
20
21
    /**
22
     * Get a response instance.
23
     *
24
     * @return Response
25
     */
26
    public function getResponse(): Response
27
    {
28
        return $this->response;
29
    }
30
}
31