LogResponse   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
dl 0
loc 35
rs 10
c 1
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
A __toString() 0 7 2
1
<?php
2
3
4
namespace Appino\Blockchain\Objects;
5
6
7
class LogResponse{
8
9
    /**
10
     * @var string
11
     */
12
    public $callback;
13
    /**
14
     * @var string
15
     */
16
    public $called_at;
17
    /**
18
     * @var string
19
     */
20
    public $raw_response;
21
    /**
22
     * @var int
23
     */
24
    public $response_code;
25
26
    public function __construct($params){
27
        if(is_null($params))
28
            return;
29
        $this->callback = data_get($params,'callback');
30
        $this->called_at = data_get($params,'called_at');
31
        $this->raw_response = data_get($params,'raw_response');
32
        $this->response_code = data_get($params,'response_code');
33
    }
34
35
    public function __toString(){
36
        $class_vars = get_class_vars(get_class($this));
37
        $response = [];
38
        foreach ($class_vars as $key => $value){
39
            $response[$key] = $this->{$key};
40
        }
41
        return json_encode($response, JSON_THROW_ON_ERROR) ."";
42
    }
43
44
}
45