JsonResponse   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 10
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Furious\Psr7\Response;
6
7
use Furious\Psr7\Response;
8
9
class JsonResponse extends Response
10
{
11
    public function __construct(array $data, int $statusCode = 200, array $headers = [], $body = null, string $version = '1.1', string $reason = null)
12
    {
13
        $body = json_encode($data);
14
        parent::__construct($statusCode, $headers + [
15
            'Content-Type' => 'application/json'
16
        ], $body, $version, $reason);
17
    }
18
}