Completed
Push — master ( 527bb5...aca9c3 )
by César
05:15
created

JsonResponse   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 7 1
1
<?php
2
3
namespace Preetender\Routing\Response;
4
5
/**
6
 * Class JsonResponse
7
 * @package Preetender\Routing\Response
8
 */
9
class JsonResponse extends BaseResponse
10
{
11
    /**
12
     * Inform headers for json requests
13
     *
14
     * @var array
15
     */
16
    protected $headers = [
17
        'Content-type' => 'application/json'
18
    ];
19
20
    /**
21
     * Format and return to requester
22
     *
23
     * @return mixed
24
     */
25
    public function render()
26
    {
27
        $this->response->setContent(json_encode($this->wrapped->render()));
28
        $this->response->headers->add($this->headers);
29
        $this->response->prepare($this->request);
30
        $this->response->send();
31
    }
32
}