ChunkedResponseException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 42
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A getResponse() 0 4 1
1
<?php
2
3
namespace Recca0120\Upload\Exceptions;
4
5
use RuntimeException;
6
use Symfony\Component\HttpFoundation\Response;
7
8
class ChunkedResponseException extends RuntimeException
9
{
10
    /**
11
     * $message.
12
     *
13
     * @var string
14
     */
15
    protected $message;
16
17
    /**
18
     * $headers.
19
     *
20
     * @var array
21
     */
22
    protected $headers;
23
24
    /**
25
     * __construct.
26
     *
27
     * @param mixed $message
28
     * @param array $headers
29
     * @param int $code
30
     */
31 4
    public function __construct($message = '', $headers = [], $code = Response::HTTP_CREATED)
32
    {
33 4
        parent::__construct(
34 4
            is_string($message) === true ? $message : json_encode($message), $code
35
        );
36
37 4
        $this->headers = $headers;
38 4
    }
39
40
    /**
41
     * getResponse.
42
     *
43
     * @return \Symfony\Component\HttpFoundation\Response
44
     */
45 2
    public function getResponse()
46
    {
47 2
        return new Response($this->getMessage(), $this->getCode(), $this->headers);
48
    }
49
}
50