MalformedResponseException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 47
ccs 6
cts 8
cp 0.75
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getResponse() 0 3 1
A setResponse() 0 3 1
A __construct() 0 8 1
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