JsonView   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 35
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A set() 0 4 1
A getVariables() 0 4 1
A file() 0 4 1
A getFile() 0 4 1
A render() 0 5 1
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