Failed Conditions
Push — master ( ba8c0d...a9ded0 )
by thomas
04:50
created

Device   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Test Coverage

Coverage 43.75%

Importance

Changes 0
Metric Value
wmc 7
dl 0
loc 52
ccs 7
cts 16
cp 0.4375
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __get() 0 3 1
A __construct() 0 3 1
A getProduct() 0 3 1
A getVendor() 0 3 1
A getPath() 0 3 1
A getSession() 0 3 1
A getObject() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BitWasp\Trezor\Bridge\Message;
6
7
/**
8
 * Properties via magic
9
 * @property int $path
10
 * @property string|null $session
11
 * @property int|null $vendor
12
 * @property int|null $product
13
 */
14
class Device
15
{
16
    /**
17
     * Device object to by wrapped
18
     *
19
     * @var \stdClass
20
     */
21
    private $msg;
22
23 3
    public function __construct(\stdClass $device)
24
    {
25 3
        $this->msg = $device;
26 3
    }
27
28
    public function __get($name)
29
    {
30
        return $this->msg->{$name};
31
    }
32
33 3
    public function getPath(): string
34
    {
35 3
        return $this->msg->path;
36
    }
37
38
    /**
39
     * @return string|null
40
     */
41 3
    public function getSession()
42
    {
43 3
        return $this->msg->session;
44
    }
45
46
    /**
47
     * @return int|null
48
     */
49
    public function getVendor()
50
    {
51
        return $this->msg->vendor;
52
    }
53
54
    /**
55
     * @return int|null
56
     */
57
    public function getProduct()
58
    {
59
        return $this->msg->product;
60
    }
61
62
    public function getObject(): \stdClass
63
    {
64
        $clone = clone $this->msg;
65
        return $clone;
66
    }
67
}
68