MergedOrderBookPriceItemResponse   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getQuantity() 0 3 1
A setQuantity() 0 4 1
A getPrice() 0 3 1
A setPrice() 0 4 1
A __construct() 0 5 1
1
<?php
2
3
namespace Carpenstar\ByBitAPI\Spot\MarketData\MergedOrderBook\Response;
4
5
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
6
use Carpenstar\ByBitAPI\Spot\MarketData\MergedOrderBook\Interfaces\IMergedOrderBookPriceResponseInterface;
7
8
class MergedOrderBookPriceItemResponse extends AbstractResponse implements IMergedOrderBookPriceResponseInterface
9
{
10
    /**
11
     * Price position value
12
     * @var float
13
     */
14
    private float $price;
15
16
    /**
17
     * Quantity position value
18
     * @var float
19
     */
20
    private float $quantity;
21
22
    /**
23
     * @param array $data
24
     */
25
    public function __construct(array $data)
26
    {
27
        $this
28
            ->setPrice($data[0])
29
            ->setQuantity($data[1]);
30
    }
31
32
    /**
33
     * @param float $price
34
     * @return $this
35
     */
36
    private function setPrice(float $price): self
37
    {
38
        $this->price = $price;
39
        return $this;
40
    }
41
42
    /**
43
     * @return float
44
     */
45
    public function getPrice(): float
46
    {
47
        return $this->price;
48
    }
49
50
    /**
51
     * @param float $quantity
52
     * @return MergedOrderBookPriceItemResponse
53
     */
54
    private function setQuantity(float $quantity): self
55
    {
56
        $this->quantity = $quantity;
57
        return $this;
58
    }
59
60
    /**
61
     * @return float
62
     */
63
    public function getQuantity(): float
64
    {
65
        return $this->quantity;
66
    }
67
}
68