Device::getPath()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 1
nc 1
nop 0
crap 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 42
    public function __construct(\stdClass $device)
24
    {
25 42
        $this->msg = $device;
26 42
    }
27
28 2
    public function __get($name)
29
    {
30 2
        return $this->msg->{$name};
31
    }
32
33 8
    public function getPath(): string
34
    {
35 8
        return $this->msg->path;
36
    }
37
38
    /**
39
     * @return string|null
40
     */
41 8
    public function getSession()
42
    {
43 8
        return $this->msg->session;
44
    }
45
46
    /**
47
     * @return int|null
48
     */
49 3
    public function getVendor()
50
    {
51 3
        return $this->msg->vendor;
52
    }
53
54
    /**
55
     * @return int|null
56
     */
57 3
    public function getProduct()
58
    {
59 3
        return $this->msg->product;
60
    }
61
62 2
    public function getObject(): \stdClass
63
    {
64 2
        $clone = clone $this->msg;
65 2
        return $clone;
66
    }
67
}
68