HttpException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 29
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
1
<?php
2
3
namespace Freyo\ApiGateway\Kernel\Exceptions;
4
5
use Psr\Http\Message\ResponseInterface;
6
7
class HttpException extends Exception
8
{
9
    /**
10
     * @var \Psr\Http\Message\ResponseInterface|null
11
     */
12
    public $response;
13
14
    /**
15
     * @var \Psr\Http\Message\ResponseInterface|\Freyo\ApiGateway\Kernel\Support\Collection|array|object|string
16
     */
17
    public $formattedResponse;
18
19
    /**
20
     * HttpException constructor.
21
     *
22
     * @param string                                   $message
23
     * @param \Psr\Http\Message\ResponseInterface|null $response
24
     * @param null                                     $formattedResponse
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $formattedResponse is correct as it would always require null to be passed?
Loading history...
25
     * @param int|null                                 $code
26
     */
27
    public function __construct($message, ResponseInterface $response = null, $formattedResponse = null, $code = null)
28
    {
29
        parent::__construct($message, $code);
30
31
        $this->response = $response;
32
        $this->formattedResponse = $formattedResponse;
33
34
        if ($response) {
35
            $response->getBody()->rewind();
36
        }
37
    }
38
}