JsonView::set()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 1
nc 1
nop 2
1
<?php
2
3
namespace App\ViewEngine;
4
5
use Core\View\ViewEngineInterface;
6
7
class JsonView implements ViewEngineInterface
8
{
9
    private $data = null;
10
11
    public function __construct($settings = [])
12
    {
13
        // dummy
14
    }
15
16
    public function set($key, $value)
17
    {
18
        // dummy
19
    }
20
21
    public function getVariables()
22
    {
23
        return [];
24
    }
25
26
    public function file($data)
27
    {
28
        $this->data = $data;
29
    }
30
31
    public function getFile()
32
    {
33
        return $this->data;
34
    }
35
36
    public function render()
37
    {
38
        header('Content-Type: application/json');
39
        return json_encode($this->data);
40
    }
41
}
42