InvalidResponseException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 24
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getResponse() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\AuthClient\Exception;
6
7
use Psr\Http\Message\ResponseInterface;
8
use RuntimeException;
9
use Throwable;
10
11
/**
12
 * InvalidResponseException represents an exception caused by invalid remote server response.
13
 */
14
class InvalidResponseException extends RuntimeException
15
{
16
    /**
17
     * @var ResponseInterface HTTP response instance.
18
     */
19
    private ResponseInterface $response;
20
21
    /**
22
     * Constructor.
23
     *
24
     * @param ResponseInterface $response HTTP response instance
25
     * @param string $message error message
26
     * @param int $code error code
27
     * @param Throwable $previous The previous exception used for the exception chaining.
28
     */
29
    public function __construct($response, $message = null, $code = 0, Throwable $previous = null)
30
    {
31
        $this->response = $response;
32
        parent::__construct($message, $code, $previous);
33
    }
34
35
    public function getResponse(): ResponseInterface
36
    {
37
        return $this->response;
38
    }
39
}
40