BalanceCallback::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 3
nc 3
nop 1
1
<?php
2
3
4
namespace Appino\Blockchain\Objects;
5
6
7
class BalanceCallback{
8
9
    public $transaction_hash;
10
    public $address;
11
    public $confirmation;
12
    public $value;
13
14
    /**
15
     * BalanceCallback constructor. You can call your custom parameters.
16
     * @param $params
17
     */
18
19
    public function __construct($params){
20
        if(is_null($params))
21
            return;
22
        foreach ($params as $key => $value){
23
            $this->{$key} = $value;
24
        }
25
    }
26
27
    public function __toString(){
28
        $class_vars = get_class_vars(get_class($this));
29
        $response = [];
30
        foreach ($class_vars as $key => $value){
31
            $response[$key] = $this->{$key};
32
        }
33
        return json_encode($response, JSON_THROW_ON_ERROR) ."";
34
    }
35
36
}
37