JsonResponse   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A setContent() 0 7 1
1
<?php
2
3
namespace Faulancer\Http;
4
5
/**
6
 * Class JsonResponse
7
 *
8
 * @package Faulancer\Http
9
 * @author  Florian Knapp <[email protected]>
10
 */
11
class JsonResponse extends Response
12
{
13
14
    /** @var array */
15
    protected $content = [];
16
17
    /**
18
     * Set content
19
     *
20
     * @param array $content
21
     *
22
     * @return self
23
     */
24
    public function setContent($content = [])
25
    {
26
        $this->setResponseHeader(['Content-Type' => 'application/json']);
27
28
        $this->content = json_encode($content);
29
        return $this;
30
    }
31
32
}