Json   A
last analyzed

Coupling/Cohesion

Components 1
Dependencies 1

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 24
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A result() 0 4 1
1
<?php
2
3
namespace League\CLImate\TerminalObject\Basic;
4
5
class Json extends BasicTerminalObject
6
{
7
    /**
8
     * The data to convert to JSON
9
     *
10
     * @var mixed $data
11
     */
12
    protected $data;
13
14 8
    public function __construct($data)
15
    {
16 8
        $this->data = $data;
17 8
    }
18
19
    /**
20
     * Return the data as JSON
21
     *
22
     * @return string
23
     */
24 8
    public function result()
25
    {
26 8
        return json_encode($this->data, JSON_PRETTY_PRINT);
27
    }
28
}
29