Completed
Push — master ( 354bbd...8413c0 )
by John
03:53
created

JSONResponse   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getAsString() 0 3 1
A getResponseData() 0 3 1
1
<?php
2
namespace LunixREST\Response;
3
4
/**
5
 * Class JSONResponse
6
 * @package LunixREST\Response
7
 */
8
class JSONResponse implements Response {
9
    /**
10
     * @var ResponseData
11
     */
12
    public $data;
13
14
    public function __construct(ResponseData $data) {
15
        $this->data = $data;
16
    }
17
18
    /**
19
     * @return string
20
     */
21
    public function getAsString(): string {
22
        return json_encode($this->data);
23
    }
24
25
    /**
26
     * @return ResponseData
27
     */
28
    public function getResponseData(): ResponseData {
29
        return $this->data;
30
    }
31
}
32