MalformedResponseException::getResponse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Acquia\Hmac\Exception;
4
5
use Psr\Http\Message\ResponseInterface;
6
7
/**
8
 * Exception thrown when a response cannot be authenticated due to a missing or
9
 * malformed header.
10
 */
11
class MalformedResponseException extends InvalidRequestException
12
{
13
    /**
14
     * @var ResponseInterface
15
     */
16
    private $response;
17
18
    /**
19
     * Creates a new MalformedResponseException instance.
20
     *
21
     * @param string $message
22
     *   The exception message.
23
     * @param \Exception|null $previous
24
     *   The previous exception.
25
     * @param int $code
26
     *   The exception code.
27
     * @param \Psr\Http\Message\ResponseInterface|null $response
28
     *   The response.
29
     */
30 3
    public function __construct(
31
        $message = "",
32
        \Exception $previous = null,
33
        $code = 0,
34
        ResponseInterface $response = null
35
    ) {
36 3
        parent::__construct($message, $code, $previous);
37 3
        $this->response = $response;
38 3
    }
39
40
    /**
41
     * Returns the response.
42
     *
43
     * @return ResponseInterface
44
     */
45 3
    public function getResponse()
46
    {
47 3
        return $this->response;
48
    }
49
50
    /**
51
     * Sets the response.
52
     *
53
     * @param ResponseInterface $response
54
     */
55
    public function setResponse($response)
56
    {
57
        $this->response = $response;
58
    }
59
}
60