OrderBookResponseItem   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
c 0
b 0
f 0
dl 0
loc 53
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setPrice() 0 4 1
A __construct() 0 5 1
A getPrice() 0 3 1
A setSize() 0 4 1
A getSize() 0 3 1
1
<?php
2
3
namespace Carpenstar\ByBitAPI\WebSockets\Derivatives\PublicChannels\OrderBook\Entities;
4
5
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
6
7
class OrderBookResponseItem extends AbstractResponse
8
{
9
    /**
10
     * @var float $price
11
     */
12
    private float $price;
13
14
    /**
15
     * @var float $size
16
     */
17
    private float $size;
18
19
    public function __construct(array $data)
20
    {
21
        $this
22
            ->setPrice($data[0])
23
            ->setSize($data[1]);
24
    }
25
26
    /**
27
     * @param float $price
28
     * @return self
29
     */
30
    private function setPrice(float $price): self
31
    {
32
        $this->price = $price;
33
        return $this;
34
    }
35
36
    /**
37
     * @return float
38
     */
39
    public function getPrice(): float
40
    {
41
        return $this->price;
42
    }
43
44
    /**
45
     * @param float $size
46
     * @return self
47
     */
48
    private function setSize(float $size): self
49
    {
50
        $this->size = $size;
51
        return $this;
52
    }
53
54
    /**
55
     * @return float
56
     */
57
    public function getSize(): float
58
    {
59
        return $this->size;
60
    }
61
}
62