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

ReceiveResponse   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A __toString() 0 7 2
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 ReceiveResponse{
10
    /**
11
     * @var string
12
     */
13
    public $address;
14
    /**
15
     * @var integer
16
     */
17
    public $index;
18
    /**
19
     * @var string
20
     */
21
    public $callback;
22
23
    public function __construct($params){
24
        if(is_null($params))
25
            return;
26
        $this->address = data_get($params,'address');
27
        $this->index = data_get($params,'index');
28
        $this->callback = data_get($params,'callback');
29
    }
30
31
    public function __toString(){
32
        $class_vars = get_class_vars(get_class($this));
33
        $response = [];
34
        foreach ($class_vars as $key => $value){
35
            $response[$key] = $this->{$key};
36
        }
37
        return Json::encode($response);
38
    }
39
40
}
41