Passed
Push — main ( b86878...e52c85 )
by Pouya
05:24
created

LogResponse::__toString()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace Appino\Blockchain\Objects;
5
6
7
use Psy\Util\Json;
0 ignored issues
show
Bug introduced by
The type Psy\Util\Json was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
class LogResponse{
10
11
    /**
12
     * @var string
13
     */
14
    public $callback;
15
    /**
16
     * @var string
17
     */
18
    public $called_at;
19
    /**
20
     * @var string
21
     */
22
    public $raw_response;
23
    /**
24
     * @var int
25
     */
26
    public $response_code;
27
28
    public function __construct($params){
29
        if(is_null($params))
30
            return;
31
        $this->callback = data_get($params,'callback');
32
        $this->called_at = data_get($params,'called_at');
33
        $this->raw_response = data_get($params,'raw_response');
34
        $this->response_code = data_get($params,'response_code');
35
    }
36
37
    public function __toString(){
38
        $class_vars = get_class_vars(get_class($this));
39
        $response = [];
40
        foreach ($class_vars as $key => $value){
41
            $response[$key] = $this->{$key};
42
        }
43
        return Json::encode($response);
44
    }
45
46
}
47