BlockCallback   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
dl 0
loc 23
rs 10
c 1
b 0
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 3
A __toString() 0 7 2
1
<?php
2
3
4
namespace Appino\Blockchain\Objects;
5
6
7
class BlockCallback{
8
9
    public $hash;
10
    public $confirmations;
11
    public $height;
12
    public $timestamp;
13
    public $size;
14
15
    public function __construct($params){
16
        if(is_null($params))
17
            return;
18
        foreach ($params as $key => $value){
19
            $this->{$key} = $value;
20
        }
21
    }
22
23
    public function __toString(){
24
        $class_vars = get_class_vars(get_class($this));
25
        $response = [];
26
        foreach ($class_vars as $key => $value){
27
            $response[$key] = $this->{$key};
28
        }
29
        return json_encode($response, JSON_THROW_ON_ERROR) ."";
30
    }
31
32
33
}
34